How to create Dynamically Controls with Customized set Label Values

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 709
hi

I have post How to create Dynamically Controls with Customized set Label Values .



private void Dclip()
{
Dt = ReturnDt("Select * from dbo.Table_1");
for (int i = 1; i<3 ; i++)
{
Label label = new Label();
label.ID = "Label" + i;
if (i == 1)
{
label.Text = "Label" + i;
}else if(i==2)
{
label.Text = Dt.DefaultView[0][0].ToString();
}
div1.Controls.Add(label);
div1.Controls.Add(new LiteralControl("<br />"));
}
}

public DataTable ReturnDt(string RecStr)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = RecStr;
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(Dt);
return Dt;
}

Comments or Responses

Login to post response