I am using this within a Multiview State.
Here is the view1 Page:-
And the View2 Page:-
The task in which i need your help is PageIndexChanging Event.
you can see the link button Select in the gridview.
when I select one row, I need to go to the view1 page. I did the coding for this function.
My task is when I click the movieName Hollowman, I want to display data in the concerned fields.

Sanjeeb LenkaPosted Aug 19, 2013, 7:43 AM
in grid design write this code:
AutoGenerateColumns="false">
in .cs write this code in rowcommand:
protected void dgvMovie_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
int id = Convert.ToInt32(e.CommandArgument);
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlDataAdapter sqlDa = new SqlDataAdapter("select * from tbl_Movie where movieid='"+id+"'", sqlCon);
DataSet sqlDS = new DataSet();
sqlDa.Fill(sqlDS);
txtMovieName.Text = sqlDS.Tables[0].Rows[0]["movieName"].ToString();
cmbLanguage.SelectedValue = sqlDS.Tables[0].Rows[0]["Languge"].ToString();
cmbGenre.SelectedValue = sqlDS.Tables[0].Rows[0]["Genre"].ToString();
cmbYear.SelectedValue = sqlDS.Tables[0].Rows[0]["movieYear"].ToString();
}
}
Sanjeeb LenkaPosted Aug 20, 2013, 12:27 AM
check this code:
in aspx grid:
AutoGenerateColumns="false" OnRowDeleting="dgvMovie_RowDeleting">
in .cs:
protected void dgvMovie_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int id = Convert.ToInt32(dgvMovie.DataKeys[e.RowIndex].Value);
if (sqlCon.State == ConnectionState.Closed)
{
sqlCon.Open();
}
SqlCommand cmd = new SqlCommand("Delete from tbl_Movie where movieid='" + id + "'", sqlCon);
cmd.ExecuteNonQuery();
sqlCon.Close();
GridFill();
}
Bineesh ViswanathPosted Aug 19, 2013, 11:32 PM
Now I want the RowDeleting event in this same program. Could you send me the code?
Sanjeeb LenkaPosted Aug 19, 2013, 8:14 AM
AutoGenerateColumns="false">
Bineesh ViswanathPosted Aug 19, 2013, 8:04 AM
Here is how it look like.
Please rectify this malfunction.
Iftikar HussainPosted Aug 19, 2013, 7:04 AM
Bineesh ViswanathPosted Aug 19, 2013, 7:01 AM
Extract ZIP file and go through all codes.
and try to find the solution.
Sanjeeb LenkaPosted Aug 19, 2013, 6:57 AM
Iftikar HussainPosted Aug 19, 2013, 6:56 AM
Bineesh ViswanathPosted Aug 19, 2013, 6:53 AM
The form would be look like when I press the link button:-
give me a solution for this.
Sanjeeb LenkaPosted Aug 19, 2013, 6:49 AM
So you given your screen shot its good . but if you share your code then only we can understand what you written and what to do.
Iftikar HussainPosted Aug 19, 2013, 6:41 AM
Regards,
Iftikar
Bineesh ViswanathPosted Aug 19, 2013, 6:40 AM
now my form look like:-
now how can i go to view1 and display correspondent data in the fields?
Iftikar HussainPosted Aug 19, 2013, 5:57 AM
Please refer the below link
http://hightechnology.in/how-to-redirect-to-another-page-by-click-on-linkbutton-in-gridview/
Regards,
Iftikar
Sanjeeb LenkaPosted Aug 19, 2013, 5:32 AM