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

Edited by jackandjill2010: n/a

6 Years
Discussion Span
Last Post by jackandjill2010

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

<asp:FormView ID="fvTest" runat="server" AllowPaging="true" OnPageIndexChanging="fvTest_PageChange">
      <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>

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;

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

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

Edited by jbisono: n/a

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.