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 LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 3:43 AM EDT
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 LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 1:32 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 19, 2013, 1:57 AM EDT
Please refer the below link
http://hightechnology.in/how-to-redirect-to-another-page-by-click-on-linkbutton-in-gridview/
Regards,
Iftikar
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 19, 2013, 2:40 AM EDT
now my form look like:-
now how can i go to view1 and display correspondent data in the fields?
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 19, 2013, 2:41 AM EDT
Regards,
Iftikar
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 2:49 AM EDT
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.
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 19, 2013, 2:53 AM EDT
The form would be look like when I press the link button:-
give me a solution for this.
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 19, 2013, 2:56 AM EDT
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 2:57 AM EDT
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 19, 2013, 3:01 AM EDT
Extract ZIP file and go through all codes.
and try to find the solution.
Iftikar HussainRank #423 · 5.9K reputationPosted Aug 19, 2013, 3:04 AM EDT
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 19, 2013, 4:04 AM EDT
Here is how it look like.
Please rectify this malfunction.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 4:14 AM EDT
AutoGenerateColumns="false">
Bineesh ViswanathRank #1,681 · 907 reputationPosted Aug 19, 2013, 7:32 PM EDT
Now I want the RowDeleting event in this same program. Could you send me the code?
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Aug 19, 2013, 8:27 PM EDT
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();
}