如何通过检查其他列中的项目模板(标签)值等于给定文本,使用放置在gridview中的图像按钮重定向到另一个页面。
this is my code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("select ID,SurveyName from SurveyMaster1 union select -1,'Select'", con);
da.Fill(dt);
DropDownList1.DataSource = dt;
DropDownList1.DataValueField = "ID";
DropDownList1.DataTextField = "SurveyName";
DropDownList1.DataBind();
DropDownList1.SelectedValue = "-1";
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("SELECT Question,QuestionType FROM Questions WHERE SurveyID = '"+ DropDownList1.SelectedValue.ToString() +"'" , con);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void imgbtnEdit_Click(object sender, ImageClickEventArgs e)
{
GridViewRow grdSelRow = GridView1.SelectedRow;
TextBox textInt = (TextBox)GridView1.FindControl("text1");
if (textInt.Text == "Text")
{
Response.Redirect("Text.aspx");
}
}
任何人都请帮助我.. 可能是我的问题不太清楚。