![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Hyperlink as button in gridview cell Hi, I've managed to include a hyperlink with a click handler in a databound gridview cell like this... <GridViewColumn Header="Title"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock> <Hyperlink Click="Hyper_OnClick"> <TextBlock Text="{Binding Path=AttachmentTitle}" /> </Hyperlink> </TextBlock> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> but can't figure out how to get the text for the link as a string inside the hyperlink click handler. How can I do this? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Hyperlink as button in gridview cell On Oct 10, 4:32 pm, Scott Walters <scottw...@xxxxxx> wrote: Quote: > Hi, > > I've managed to include a hyperlink with a click handler in a databound > gridview cell like this... > > <GridViewColumn Header="Title"> > <GridViewColumn.CellTemplate> > <DataTemplate> > <TextBlock> > <Hyperlink Click="Hyper_OnClick"> > <TextBlock Text="{Binding Path=AttachmentTitle}" /> > </Hyperlink> > </TextBlock> > </DataTemplate> > </GridViewColumn.CellTemplate> > </GridViewColumn> > > but can't figure out how to get the text for the link as a string inside > the hyperlink click handler. How can I do this? customers that I had. When I clicked on the customer I wanted to edit that record. Therefore, in the "Tag" of the Hyperlink I placed a binding to the customer id. That was the easiest way I found to recover information I needed about the record that was clicked. Here is the snippet... <ListView Name="customerList"> <ListView.View> <GridView> <GridViewColumn Header="Name"> <GridViewColumn.CellTemplate> <DataTemplate> <TextBlock> <Hyperlink Click="EditCustomer" Tag="{Binding Path=customerid}"> <TextBlock Text="{Binding Path=name}"/> </Hyperlink> </TextBlock> </DataTemplate> </GridViewColumn.CellTemplate> </GridViewColumn> </GridView> </ListView.View> </ListView> and here is an example for accessing it... MessageBox.Show("Customer: " + ((Hyperlink)sender).Tag.ToString()); .... it works great! |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Gridview with more than 2 tables | .NET General | |||
| Hyperlink from web page to specific cell in specific Excel sheet | VB Script | |||
| CTP Out-GridView | PowerShell | |||
| Hyperlink button malfunction | Vista mail | |||