Absolute position of datagrid

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
 
J

Jenny K

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.
 
V

Vaibhav

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.
 
V

Vidar Petursson

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
==============================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top