Tuesday, January 3, 2012

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 lblVertex = new Label();
    protected void Page_Load(object sender, EventArgs e)
    {
        lblVertex.ID = "lblVertex";
        lblVertex.Text = "Vertex";
        this.form1.Controls.Add(lblVertex);
        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(lblVertex);
        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)
    {
        lblmess.Visible = !lblmess.Visible;
    }
   
}

No comments:

Post a Comment