Prasad Bolla's SharePoint Blog

Click Here to go through the Interesting posts within my Blog.

Click Here to go through the new posts in my blog.

Monday, November 28, 2011

Sample Code working with UpDatePanel Dynamically.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
    Label lblSample = new Label();
    protected void Page_Load(object sender, EventArgs e)
    {
        lblSample.ID = "lblSample";
        lblSample.Text = "Sample";
        this.form1.Controls.Add(lblSample);
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<Table bgcolor='Green'>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<Tr>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<Td>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<Font color='White'>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("<Strong>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(lblSample);
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("</Strong>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("</Font>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("</Td>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("</Tr>"));
        UpdatePanel1.ContentTemplateContainer.Controls.Add(new LiteralControl("</Table>"));
    }
    protected void Timer1_Tick(object sender, EventArgs e)
    {
        lblSample.Visible = !lblSample.Visible;
    }
    
}

No comments:

Post a Comment