Solved

Asp.net, vb - dynamic table

Posted on 2010-09-02
5
353 Views
Last Modified: 2012-05-10
On my asp.net page, after querying a database, I need to create a dynamic table with TextBoxes to display the results.

The user will be able to edit the values in the TextBoxes and click a button to write these values to a different database table.

I need some examples (vb please).
0
Comment
Question by:Rick
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 7

Expert Comment

by:Inteqam
ID: 33592783
0
 
LVL 13

Accepted Solution

by:
Rick earned 0 total points
ID: 33621545
I got my own solution by binding a gridview to a datatable, then using a for loop to read the changes and write the values to the db.
0
 
LVL 13

Author Closing Comment

by:Rick
ID: 33621554
found my own solution
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 33622716
But i think mine is valid!!!
0
 
LVL 7

Expert Comment

by:Inteqam
ID: 33623074
you said that  you did:
1- binding a gridview to a datatable,
2-  using a for loop to read the changes and write the values to the db.


This was exactly what my solution did:

10 Binding :
<Columns>
<asp:BoundColumn DataField="EmployeeId" HeaderText="EmployeeId"></asp:BoundColumn>
  <asp:TemplateColumn HeaderText="LastName">
     <ItemTemplate>
        <asp:TextBox EnableViewState=True id=LastName runat="server"
         Text='<%# DataBinder.Eval(Container, "DataItem.LastName") %>'>
         </asp:TextBox>
     </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn HeaderText="FirstName">
      <ItemTemplate>
        <asp:TextBox ID="FirstName" enableViewState = true runat="server"
            Text='<%# DataBinder.Eval(Container, "DataItem.FirstName") %>'>
        </asp:TextBox>
     </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn HeaderText="HomePhone">
      <ItemTemplate>
        <asp:TextBox ID="HomePhone" enableViewState = true runat="server"
            Text='<%# DataBinder.Eval(Container, "DataItem.HomePhone") %>'>
        </asp:TextBox>
     </ItemTemplate>
     </asp:TemplateColumn>
</Columns>

Then looping

 foreach(DataGridItem itm in DataGrid1.Items )
    {
        foreach (DatasetColumnNameToGridColumnIndex ColName in System.Enum.GetValues(typeof(DatasetColumnNameToGridColumnIndex)))
        {          
            UpdateDataTableFromGrid(dt, ColName.ToString(), itm, (int)ColName);                  
        }
    }
    DataGrid1.DataSource=dt;
    Session["dt"]=dt;
    DataGrid1.DataBind();
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question