Absolute position of datagrid

  • Thread starter Thread starter Kenneth
  • Start date Start date
K

Kenneth

Hi,

In a webform I have a datagrid in a certain position using
gridlayout.

<asp:DataGrid id="dgrdSkada" style="Z-INDEX: 107; LEFT:
16px; POSITION: absolute; TOP: 200px" runat="server"
CssClass="Styles.css" Height="184px" Width="592px"
AutoGenerateColumns="False" EnableViewState="False">

Under certain conditions I'd like to have the TOP position
to change. How can I code that under a Button_click?

TIA

/Kenneth
 
Just a thought...the <asp:Datagrid> translates into a <table> tag when
rendered if I recall correctly. Have you tried encapsulating the datagrid
in a <div> and coding the dynamic position of the <div>? You'll probably
have an easier time doing this client-side.
 
Instead of setting style in the control attributes at design time.
If you set the style in your page load like this ,
dgrdSkada.Style="Z-INDEX: 107; LEFT: 16px; POSITION: absolute; TOP: 200px"
and change it on your Button_Click to
dgrdSkada.Style="Z-INDEX: 107; LEFT: 16px; POSITION: absolute; TOP: 100px"

this should solve the problem.
 
Hi

On client?
<input type="button" onclick="setPos('elementID',100)">
function setPos(sElementID,posTop){
var e = document.getElementById(sElementID);
if(e!=null) e.posTop = posTop;
}

Server code use
element.Attributes.Add("style","position:absolute;top:" + desiredPos... etc

--
Best Regards
Vidar Petursson
==============================
Microsoft Scripting MVP
http://www.microsoft.com/technet/scriptcenter
==============================
 
Back
Top