Wednesday, July 4, 2012

How to create a hyperlink or any other control dynamically and add to this in panel control

 Here i am show how can you create hyperlink dynamically and add to it in panel control.  
 Here we can also create line break dynamically.  
 Take a panel in your .aspx page as given below:  
 <asp:Panel ID="Panel2" runat="server" CssClass="applycss">  
 .cs code to create HyperLink dynamically and add to panel.  
 HyperLink hyprlink = new HyperLink();  
 hyprlink.Text = "Click here to subscribe.";  
 hyprlink.CssClass = "Ima12";  
 hyprlink.NavigateUrl = "http://yourdomain/SubApplication/?key=passparameter&rs=2";  
 Panel2.Controls.Add(new LiteralControl("<br />"));  
 Santosh Singh