I have a GridView and have converted a BoundField into a TemplateField.
In my GridView I have 2 text fields, one short and a one long. When I load the GridView I show the short text field as a LinkButton and the long text field as an invisible TeplAteField. When I click on the LinkButton I need to retrieve the long text.
This is the markup code being created:
:):)
Code:
<asp:TemplateField HeaderText="Notes1" Visible="False">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("item_notes1") %>'></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("item_notes1") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Here is my code for the click on the linkbutton, need the code to retrieve the TemplateField value. My code does not work
Code:
Protected Sub GridView2_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView2.RowCommand
If e.CommandName = "notes" Then
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim mySelectedRow As GridViewRow = GridView2.Rows(index)
Dim mySelectedCell As TableCell
mySelectedCell = mySelectedRow.Cells(6)
Dim MyText As String = mySelectedCell.Text
:):):)