Tuesday, January 26, 2010

Display Page Detail in Label

void displaypagedetail()
{
conn.Open();
hprHome.Visible = true;
if (Request.Params.Get(“state”) == “detail”)
{
Btn_save.Visible = false;
Btn_cancel.Visible = false;
hprHome.Visible = true;
}
string ID = Request.Params.Get(“id”).ToString();
string strQuery = “Select * from tbl_test where id= ‘” + Request.Params.Get(“id”) + “‘”;
cmd1 = new SqlCommand(strQuery, conn);
dr1 = cmd1.ExecuteReader();
try
{
if (dr1.Read())
{
txtText.Text = dr1["name"].ToString();
if (imgurl1 == “”)
{
fileupload.Enabled = true;
}
else
{
fileupload.Enabled = false;
}
}
}
finally
{
conn.Close();
}
}