Gautam Buddha Temple Varanasi,Varanasi - Buddhist Pilgrimage

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 asp.net panel in your .aspx page as given below:  
   
 <asp:Panel ID="Panel2" runat="server" CssClass="applycss">  
 </asp:Panel>  
   
 .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(hyprlink);  
 Panel2.Controls.Add(new LiteralControl("<br />"));  
   
 Regards  
 Santosh Singh