How to Redirect Another Page with GridView Item Template Control Value
Am creating a project.On my project in a page i am having 3 Links in a GridView.
1.ACCEPT
2.REJECT
2.EDIT
if i am click any link the function should be done. & create session value also.
i am using First 2 following code
1.ACCEPT am using
.ASPX
OnRowUpdating="cgv_RowUpdating"
.CODE BEHIND
protected void cgv_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
Label lblgvenquiryid = (Label)cgv.Rows[e.RowIndex].FindControl("lblenquiryid");
Session["Session_enquiryid"] = lblgvenquiryid.Text.Trim();
}
2.REJECT am using
.ASPX
OnRowDeleting="cgv_RowDeleting"
.CODE BEHIND
protected void cgv_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Label lblgvenquiryid = (Label)cgv.Rows[e.RowIndex].FindControl("lblenquiryid");
Session["Session_enquiryid"] = lblgvenquiryid.Text.Trim();
}
3.REJECT am using
OnRowCommand :
Error:Index was out of range
LinkButton:
Error :Input String was not a correct Format.
Button:
Unable to cast object of type 'System.Web.UI.WebControls.ImageButton' to type 'System.Web.UI.WebControls.Button'.
Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.UI.WebControls.ImageButton' to type 'System.Web.UI.WebControls.Button'.
Source Error:
protected void imgbtnUpdate_Click(object sender, ImageClickEventArgs e)
{
GridViewRow Row = ((Button)sender).Parent.Parent as GridViewRow;
int index = Row.RowIndex;
Session["Session_Enquiry_Id"] = ((Label)cgv.Rows[index].FindControl("lblenquiryid")).Text;
}
If i am click EDIT link or a button it should go to another page with only my created session value.
So i don't know how to done third one and am struggling.
So anyone know please help me to i am done this task.
Thanks With
Paul.S