Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > gridview column values to another page via gridview hyperlink column

Reply
Thread Tools

gridview column values to another page via gridview hyperlink column

 
 
Keith G Hicks
Guest
Posts: n/a
 
      02-18-2008
I have a GridView on a page called "MissingPersons.aspx". One of the columns
is an unbound hyperlink column. I do not want to show the "select" column in
the grid. So "Enable Selection" is not checked. The grid is a list of
missing people. Visitors can look at the list and click the hyperlink column
to navigate to another page where they can fill in info on that person.

The GridView has 3 other columns (in addition to the hyperlink column
mentioned above). They are MissingPersonID (primary key of the table the
grid is based on); FirstName; LastName.

I need code in the page with the GridView that finds the value of the 3
columns and then passes those values to the 2nd page which will show all 3
values in TextBoxes.

I have no idea where to even begin on some of this. I'm using VB (not using
code-behind). I need some soft of event that fires when the user clicks the
hyperlink column and then set the 3 values somewhere and then navigate to
the 2nd page where it can see those values.

Thanks,

Keith


 
Reply With Quote
 
 
 
 
gnewsgroup
Guest
Posts: n/a
 
      02-18-2008
Keith G Hicks wrote:
> I have a GridView on a page called "MissingPersons.aspx". One of the columns
> is an unbound hyperlink column. I do not want to show the "select" column in
> the grid. So "Enable Selection" is not checked. The grid is a list of
> missing people. Visitors can look at the list and click the hyperlink column
> to navigate to another page where they can fill in info on that person.
>
> The GridView has 3 other columns (in addition to the hyperlink column
> mentioned above). They are MissingPersonID (primary key of the table the
> grid is based on); FirstName; LastName.
>
> I need code in the page with the GridView that finds the value of the 3
> columns and then passes those values to the 2nd page which will show all 3
> values in TextBoxes.
>
> I have no idea where to even begin on some of this. I'm using VB (not using
> code-behind). I need some soft of event that fires when the user clicks the
> hyperlink column and then set the 3 values somewhere and then navigate to
> the 2nd page where it can see those values.
>
> Thanks,
>
> Keith


I have done this in a project of mine. you can format the hyperlink
by binding the columns values to query string variables. got the idea?
 
Reply With Quote
 
 
 
 
gnewsgroup
Guest
Posts: n/a
 
      02-18-2008
Keith G Hicks wrote:
> I have a GridView on a page called "MissingPersons.aspx". One of the columns
> is an unbound hyperlink column. I do not want to show the "select" column in
> the grid. So "Enable Selection" is not checked. The grid is a list of
> missing people. Visitors can look at the list and click the hyperlink column
> to navigate to another page where they can fill in info on that person.
>
> The GridView has 3 other columns (in addition to the hyperlink column
> mentioned above). They are MissingPersonID (primary key of the table the
> grid is based on); FirstName; LastName.
>
> I need code in the page with the GridView that finds the value of the 3
> columns and then passes those values to the 2nd page which will show all 3
> values in TextBoxes.
>
> I have no idea where to even begin on some of this. I'm using VB (not using
> code-behind). I need some soft of event that fires when the user clicks the
> hyperlink column and then set the 3 values somewhere and then navigate to
> the 2nd page where it can see those values.
>
> Thanks,
>
> Keith


I have done this in a project of mine. you can format the hyperlink
by binding the columns values to query string variables. got the idea?
 
Reply With Quote
 
Keith G Hicks
Guest
Posts: n/a
 
      02-18-2008
No. I had no idea where to start. It took me all night to figure this out
and pretty much none of the help I found online was complete enough to help
someone new like me. Sorry to say if you're going to post help to someone
that's clearly confused and has no idea where to begin and you're goign to
be as vague as you were below, don't even bother. It's like a kick in the
face and only makes learning more frustrating.

People kept talking about turnign the column into a template column but
that's not necessary at all. You just have to include both values in the
DataNavigateUrlFields and in the DataNavigateUrlFormatString properties.
What nobody mentions is that the index # used in the
DataNavigateUrlFormatString property does NOT refer to the grid column but
to the field in DataNavigateUrlFields. So you end up with something like
this in the code:

<asp:HyperLinkField
DataNavigateUrlFields="MissingClassmateID,MissingC lassmateFullName"
DataNavigateUrlFormatString="MissingClassmateInfo. aspx?MissingClassmateID={0
}&amp;MissingClassmateFullName={1}" Text="I know where this person is!" />

There's no need for the text in the column to be bound to anything in the
datasource although it could be. I didn't want it to be so I'm using "I know
where this person is" as the hyperlink text. The other columns show the
person's name and such. As you can see the DataNavigateUrlFields property
has 2 fields listed separated by commas (MissingCLassmateID &
MissingClassmateFullName). The DataNavigateUrlFormatString property shows
the page to go to, then the ? for the parameters and then each of the 2
parameters after that. The {0} and the {1} refer to the fields listed in
DataNavigateUrlFields.

Now I have simple code in the target page using
Request.QueryString("MissingClassmateID").ToString , etc. to assign those
values to text boxes on the target page.

Anyway, this works perfectly. It wasn't really tricky to do. In fact once I
realized that I needed the same # of parameters in each of the 2 properties
above and that the index # refers to the first property (and not the grid
columns) it was easy. The problem is that I didnt find that explained
clearly anywhere at all. Everyone tried to make it WAY too complicated. Ugh!



"gnewsgroup" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> I have done this in a project of mine. you can format the hyperlink
> by binding the columns values to query string variables. got the idea?



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net 0 04-12-2007 03:11 PM
GridView - Setting the text of the 'select' column to the value of another column Greg Smith ASP .Net Web Controls 0 04-12-2007 02:40 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
How to Assign Paramer & Values to a hyperlink column in a datagrid =?Utf-8?B?WVNSYW8=?= ASP .Net 1 05-31-2004 10:02 AM



Advertisments