0
I managed to do this in VB.NET
, but now I need to do it in C#
and I can’t turn the code the right way.
I have this Gridview:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="BatchID" >
<Columns>
<asp:BoundField DataField="BatchID" HeaderText="BatchID" InsertVisible="False" ReadOnly="True" SortExpression="BatchID" />
<asp:BoundField DataField="Product" HeaderText="Product" SortExpression="Product" />
<asp:BoundField DataField="BatchSize" HeaderText="BatchSize" SortExpression="BatchSize" />
<asp:BoundField DataField="Priority" HeaderText="Priority" SortExpression="Priority" />
<asp:BoundField DataField="StartReq" HeaderText="StartReq" SortExpression="StartReq" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
</Columns>
</asp:GridView>
The data I put in it, I bring through an Access bank that I created. In VB.NET
I managed to make it work, but I need to make this code work on C#
now.
This is the code on VB.NET
that I need to pass on to C#
Private Sub GridView1_LoadData(sender As Object, e As EventArgs) Handles Me.Load
Dim dtAllBatches As New Northwind.AllBatchesDataTable
Using da As New NorthwindTableAdapters.AllBatchesTableAdapter
da.Fill(dtAllBatches)
End Using
GridView1.DataSource = dtAllBatches.DefaultView
GridView1.DataBind()
End Sub
I was doing in VB.NET
, but I was wrong and it was meant to be done in C#
.
I tried to find a way to make it work on the Internet, but I couldn’t find something to help me and at least understand how I should do it.
I used the way you told me, but it just went wrong. It didn’t work.
– Matheus Alves de Oliveira
What mistake you made ?
– Marcos Marques
This: Unrecognized escape Sequence
;
. But I can’t understand why, being that it has at the end of the line.– Matheus Alves de Oliveira