Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

How to dynamicaly add values from code in FormView

$
0
0

Hi

I have a database with some software inventory data. I want to populate this data in a form view, when you selecting a device.

DeviceInformation.aspx:

           <asp:FormView runat="server" AllowPaging="false" EnableViewState="false" ID="FormSwInfo">
               <ItemTemplate>
                   <hr />
                   <div id="SwiToggle">
                       <h3> Software Inventory </h3>
                   </div>
                       
                   <div id="SwiContent" hidden="hidden"> 'had a javascript to slideToggle it
                   <table id="SwiTable" border="0">
                    
                    <tr>
                        <td class="ProductPropertyLabel"><%# Eval("Name")%></td>
                        <td class="ProductPropertyValue">
                            <%# Eval("Version")%></td>
                    </tr>

                   </table>
                   </div>

               </ItemTemplate>
           </asp:FormView> 

Code behind:

    Private SwiDt As DataTable

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If sender.ClientQueryString <> "" Then

            Dim sn As String = Split(sender.ClientQueryString, "=")(1)
            Dim wservice As WebService = New WebService

            SwiDt = wservice.GetSwInv(sn)

            FormSwInfo.DataSource = SwiDt
            FormSwInfo.DataBind()

        End If

    End Sub

This code is working, BUT it onlys show the first software inventory, and i had a lot of more rows in my data table i want to show. But i really dont know how i can do a loop so all thw rows can be populated in my form view.


Viewing all articles
Browse latest Browse all 23244

Trending Articles