Hi all,
I am new to asp.net, I am preparing a asp project using vb.net code. I want to display the content in gridview in a text box. The gridview is connected with the database.
I tried this by Making the properties of Gridview "Auto Generate Select Button - True" and then I tried the below coding:
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged
TextBox1.Text = GridView1.SelectedRow.Cells[1].Text
TextBox2.Text = GridView1.SelectedRow.Cells[2].Text
TextBox3.Text = GridView1.SelectedRow.Cells[3].Text
TextBox4.Text = GridView1.SelectedRow.Cells[4].Text
TextBox5.Text = GridView1.SelectedRow.Cells[5].Text
TextBox6.Text = GridView1.SelectedRow.Cells[6].Text
End Sub
In these 6 textboxs, textbox 1, 2, 4, 5 are integers.
In source code I have added:
<asp:GridView ID="GridView1" runat="server" onselectedIndexChanged="GridView1_SelectedIndexChanged" Width="529px"
style="margin-top: 0px" PageSize="3"
AllowPaging="True" BorderColor="White" BorderStyle="Ridge"
SelectedIndex="0" AutoGenerateSelectButton="True">
</asp:GridView>
But in coding itself I got error that "Value of type
'System.Web.UI.WebControls.TableCellCollection' cannot be converted to 'String'." and "Identifier expected."
Can you please help me on this?