I am stuck trying to use a asp:grid view. I am pulling the information from a mysql database using the visual studio wizard.

However, I don't want all of the information to be showing in the gridview, this is also fine I'm able to display relevant data by changing the code in my aspx.cs class.

The idea of displaying the information is so that the user is able to click the select button and be redirected to another page which has pulled the information relevant to the row they selected from the grid view so that the user can then amend what is there.

I have managed to try and pass my data through to the relevant text fields via multiple sessions, however when doing this I can only choose the fields which are actually being displayed on the grid view.

Default.aspx

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string itemName = gridStock.SelectedRow.Cells[0].Text;
        Session["itemName"] = itemName;
     }

StockDetailedView.aspx

protected void Page_Load(object sender, EventArgs e)
    {
        txtItemName.Text = Session["itemName"].ToString();
    }

This really has stumped me and I don't know what to do, any advice would be much appreciated.

Related posts

Recent Viewed