Live Chat Icon For mobile
Live Chat Icon

Is there a way to set the position of the controls dynamically

Platform: ASP.NET| Category: Controls

Yes.


<asp:Button id='Button1' style='Z-INDEX: 101; LEFT: 116px; POSITION: absolute; TOP: 152px' runat='server'
	Text='Move'></asp:Button>
<asp:RadioButtonList id='RadioButtonList1' style='Z-INDEX: 103; LEFT: 87px; POSITION: absolute; TOP: 27px'
	runat='server' AutoPostBack='True'>
	<asp:ListItem Value='10px'>10 pixels</asp:ListItem>
	<asp:ListItem Value='100px'>100 pixels</asp:ListItem>
	<asp:ListItem Value='200px'>200 pixels</asp:ListItem>
</asp:RadioButtonList>

VB.NET


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
	’ Put user code to initialize the page here
	If Not Page.IsPostBack Then
	            Button1.Style.Add('LEFT', '1px')
	End If
End Sub ’Page_Load

Private Sub RadioButtonList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButtonList1.SelectedIndexChanged
	Button1.Style.Add('LEFT', RadioButtonList1.SelectedItem.Value.ToString())
End Sub ’RadioButtonList1_SelectedIndexChanged 

C#


private void Page_Load(object sender, System.EventArgs e)
{
	// Put user code to initialize the page here
	if (!Page.IsPostBack )
	{
		Button1.Style.Add('LEFT', '1px');
	}
}

private void RadioButtonList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
	Button1.Style.Add('LEFT',RadioButtonList1.SelectedItem.Value.ToString());
}

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.