hi
this is Film table in database
Id
|
Daste
|
preference
|
1
|
film
|
5
|
2
|
serial
|
4
|
3
|
serial
|
1
|
4
|
film
|
2
|
and bind gridview from this table and ordred by Preference Column I put Linknbutton in gridview that code is:
protected void LinkButton11_Click(object sender, EventArgs e)
{
GridViewRow row = (sender as LinkButton).NamingContainer as GridViewRow;
int id = Convert.ToInt32(GridView2.DataKeys[row.RowIndex].Value);
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand cmd = General.GetCommand("Filmserial_Info", conn))
{
cmd.Parameters.AddWithValue("@id", id);
conn.Open();
object daste = cmd.ExecuteScalar();
conn.Close();
if (daste.ToString()=="film")
{
Response.Redirect("EditFilm.aspx? &id=" + id);
}
else
{
Response.Redirect("CreateSerial.aspx?&Id=" + id);
}
problem is in this line:
int id = Convert.ToInt32(GridView2.DataKeys[row.RowIndex].Value);
I want when I click on linkbutton it use Id but here it use Preference data How I can define that according to Id column it go to
Response.Redirect("EditFilm.aspx? &id=" + id);
best regards
neda