Hi i have a simple question i was wondering how to display the existing data in C# objects like Textbox, combobox or labels. At the moment a sql database file, one of the tables data is currently displayed in the datagridview control just fine.
But what i would like to get is each row, for example column1, column2,column3 of row1 to be displayed in textbox1,textbox2,textbox3 respectively. and then when i press the next button i would like to go the next entry which means column1, column2,column3 of row2 still in textbox1,textbox2,textbox3
This is something similarhttp://msdn.microsoft.com/en-us/library/aa984467%28VS.71%29.aspxto what i want to do but i am using LINQ so the article above is old and i am using LINQ and i am new to LINQ please help me out, i attached a file of my code as there is no point attaching the whole code here, and i am using the northwind database, the default Microsoft database as my default database, so it is easier for us to communicate...
thanks in advance

I think you can do this.
in your aspx page.

<asp:FormView ID="fvTest" runat="server" AllowPaging="true" OnPageIndexChanging="fvTest_PageChange">
   <ItemTemplate>
      <asp:TextBox ID="txt1" runat="server" Text='<%#Eval("id") %>'></asp:TextBox>
      <asp:TextBox ID="txt2" runat="server" Text='<%#Eval("part") %>'></asp:TextBox>
      <asp:TextBox ID="txt3" runat="server" Text='<%#Eval("rev") %>'></asp:TextBox>
</ItemTemplate>
</asp:FormView>

in the page source
call the BindForm() method in the page load or any other place you want.

private void BindForm()
{
   DemandSupplyLinkDataContext db = new DemandSupplyLinkDataContext();
   var x = from y in db.CUST_ORDER_LINEs
      select new
      {
         id = y.CUST_ORDER_ID,
         part = y.CUSTOMER_PART_ID,
         rev = y.DRAWING_REV_NO
      };
   fvTest.DataSource = x;
   fvTest.DataBind();
}

protected void fvTest_PageChange(object sender, FormViewPageEventArgs e)
{
   fvTest.PageIndex = e.NewPageIndex;
   BindForm();
}

if you use a linqdatasource object and bind the formview with it, i think you dont need to create the pageindexchange method.

Well thanks but i am using windows application form not aspx tks

Oh my bad, did not realize that!!!, but are you still having problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.