Jump to content

Anyone here know asp.net 2.0 and c#?


Recommended Posts

How would I go about hitting Select and displaying the record in the FormView on a different page?

This guy was doing exactly what I was trying to do...

http://forums.asp.net/p/1135951/1818231.aspx#1818231

CODE

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)

{

GridViewRow mySelectedRow = ((LinkButton)sender).Parent.Parent as GridViewRow; //I get an error on this line... Unable to cast object of type 'System.Web.UI.WebControls.GridView' to type 'System.Web.UI.WebControls.LinkButton'.

string myPrimaryID = ((Label)mySelectedRow.FindControl("CustomerID")).Text; //Is this where I put the name of the Column that stores my tables unique id's?Server.Transfer("display.aspx?ID=" + myPrimaryID);

}

I don't know how I am supposed to get the ID of the current selected person. When looking at the users in the gridview, there is a Column named "CustomerID" located in my table "Customer" that shows the corresponding ID's of the person.

DataKeyNames="CustomerID" DataSourceID="SqlDataSource1" Here is some information that the datagrid is using to pull this info.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...