Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 18, 2013 06:07 PM by funluckykitty
Member
9 Points
32 Posts
Jan 17, 2013 10:52 PM|LINK
I'm trying to get the keyvalue from a selected gridview column and can't find a reference to the syntax.
Tried this...
lblDebug.Text = SqlDataSource1.SelectParameters("confirmationNumber").ToString()
Contributor
2128 Points
459 Posts
Jan 17, 2013 11:00 PM|LINK
try this:
lblDebug.Text = SqlDataSource1.SelectParameters("confirmationNumber").DefaultValue
Jan 17, 2013 11:10 PM|LINK
Just tried this and get a null exception when the page loads. Not sure why since I put it in the selected handler
TlblDebug.Text = row.Cells(2).Text
Jan 17, 2013 11:12 PM|LINK
I'm getting the same - null reference exception on that statement in the debugger.
Jan 18, 2013 05:00 PM|LINK
are you trying to get the sqldatasource key or text in gridview cell?
gridview cell: e.row.cells(1).text
in rowdatabound event
Participant
1469 Points
1547 Posts
Jan 18, 2013 06:07 PM|LINK
How about something like
lblDebug.Text=(gridview1.DataKeys(DirectCast(btn.NamingContainer, GridViewRow).RowIndex).Values("confirmationNumber"))
zeras
Member
9 Points
32 Posts
Getting data from a selected gridview column
Jan 17, 2013 10:52 PM|LINK
I'm trying to get the keyvalue from a selected gridview column and can't find a reference to the syntax.
Tried this...
lblDebug.Text = SqlDataSource1.SelectParameters("confirmationNumber").ToString()
UstesG
Contributor
2128 Points
459 Posts
Re: Getting data from a selected gridview column
Jan 17, 2013 11:00 PM|LINK
try this:
lblDebug.Text = SqlDataSource1.SelectParameters("confirmationNumber").DefaultValueBut don't expect me to do your job!
zeras
Member
9 Points
32 Posts
Re: Getting data from a selected gridview column
Jan 17, 2013 11:10 PM|LINK
Just tried this and get a null exception when the page loads. Not sure why since I put it in the selected handler
TlblDebug.Text = row.Cells(2).Text
zeras
Member
9 Points
32 Posts
Re: Getting data from a selected gridview column
Jan 17, 2013 11:12 PM|LINK
I'm getting the same - null reference exception on that statement in the debugger.
UstesG
Contributor
2128 Points
459 Posts
Re: Getting data from a selected gridview column
Jan 18, 2013 05:00 PM|LINK
are you trying to get the sqldatasource key or text in gridview cell?
gridview cell: e.row.cells(1).text
in rowdatabound event
But don't expect me to do your job!
funluckykitt...
Participant
1469 Points
1547 Posts
Re: Getting data from a selected gridview column
Jan 18, 2013 06:07 PM|LINK
How about something like
lblDebug.Text=(gridview1.DataKeys(DirectCast(btn.NamingContainer, GridViewRow).RowIndex).Values("confirmationNumber"))