// First page in which select the chekbox for passing value to another page .
protected void Gridvaluepass_Click(object sender, EventArgs e)
{
ArrayList selectedValues = new ArrayList();
foreach (GridViewRow row in GridView1.Rows)
{
bool result = ((CheckBox)row.FindControl("CheckBox1")).Checked; // finds the selected checkbox control
if (result)
{
int categoryID = Convert.ToInt32(((Label)row.FindControl("Label10")).Text); // find the selected row value control which is unique
selectedValues.Add(categoryID);
}
}
Session["SELECTEDVALUES"] = selectedValues; // pass the selected value with the help of session
Session["view"] = "view";
Response.Redirect("complaint.aspx");
}
// Second page which displays the selected value of previous page
protected void Page_Load(object sender, EventArgs e)
{
if (Session["SELECTEDVALUES"] != null ) // check that session is available or not
{
ArrayList selectedValues = (ArrayList)Session["SELECTEDVALUES"];
foreach (int intValue in selectedValues)
{
maincall(intValue);
}
}
}
public void maincall(int intValue)
{
con.Open();
string s = " select cno,name,type,zone,ward,pno,lmark,mob,ticket,tstatus from complaint1 where id='"+intValue.ToString()+"' ";
SqlDataAdapter da=new SqlDataAdapter(s,con);
DataSet ds=new DataSet();
da.Fill(ds);
TextBox1.Text=ds.Tables[0].Rows[0]["cno"].ToString();
TextBox2.Text=ds.Tables[0].Rows[0]["name"].ToString();
TextBox8.Text = ds.Tables[0].Rows[0]["mob"].ToString();
TextBox9.Text = ds.Tables[0].Rows[0]["ticket"].ToString();
DropDownList1.SelectedItem.Text = ds.Tables[0].Rows[0]["tstatus"].ToString();
DropDownList2.SelectedItem.Text = ds.Tables[0].Rows[0]["zone"].ToString();
DropDownList3.SelectedItem.Text = ds.Tables[0].Rows[0]["ward"].ToString();
DropDownList4.SelectedItem.Text = ds.Tables[0].Rows[0]["type"].ToString();
con.Close();
}
protected void Gridvaluepass_Click(object sender, EventArgs e)
{
ArrayList selectedValues = new ArrayList();
foreach (GridViewRow row in GridView1.Rows)
{
bool result = ((CheckBox)row.FindControl("CheckBox1")).Checked; // finds the selected checkbox control
if (result)
{
int categoryID = Convert.ToInt32(((Label)row.FindControl("Label10")).Text); // find the selected row value control which is unique
selectedValues.Add(categoryID);
}
}
Session["SELECTEDVALUES"] = selectedValues; // pass the selected value with the help of session
Session["view"] = "view";
Response.Redirect("complaint.aspx");
}
// Second page which displays the selected value of previous page
protected void Page_Load(object sender, EventArgs e)
{
if (Session["SELECTEDVALUES"] != null ) // check that session is available or not
{
ArrayList selectedValues = (ArrayList)Session["SELECTEDVALUES"];
foreach (int intValue in selectedValues)
{
maincall(intValue);
}
}
}
public void maincall(int intValue)
{
con.Open();
string s = " select cno,name,type,zone,ward,pno,lmark,mob,ticket,tstatus from complaint1 where id='"+intValue.ToString()+"' ";
SqlDataAdapter da=new SqlDataAdapter(s,con);
DataSet ds=new DataSet();
da.Fill(ds);
TextBox1.Text=ds.Tables[0].Rows[0]["cno"].ToString();
TextBox2.Text=ds.Tables[0].Rows[0]["name"].ToString();
TextBox8.Text = ds.Tables[0].Rows[0]["mob"].ToString();
TextBox9.Text = ds.Tables[0].Rows[0]["ticket"].ToString();
DropDownList1.SelectedItem.Text = ds.Tables[0].Rows[0]["tstatus"].ToString();
DropDownList2.SelectedItem.Text = ds.Tables[0].Rows[0]["zone"].ToString();
DropDownList3.SelectedItem.Text = ds.Tables[0].Rows[0]["ward"].ToString();
DropDownList4.SelectedItem.Text = ds.Tables[0].Rows[0]["type"].ToString();
con.Close();
}
No comments:
Post a Comment