none
Databind, ListView Client DropDownList RRS feed

  • Question

  •  

     

    hi

     

    How can databind ListView Client DropDownList ?

     

    My listview have inserttemplate this have one dropdownlist  i want bind data from database

     

    how can i do ?

     

     

     

    <asp:ListView ID="lvwCustomers" runat="server" DataKeyNames="M_ID" OnItemCommand="lvwCustomers_ItemCommand"

    OnItemCanceling="lvwCustomers_ItemCanceling" OnItemDeleting="lvwCustomers_ItemDeleting"

    OnItemEditing="lvwCustomers_ItemEditing" OnItemInserting="lvwCustomers_ItemInserting" OnItemDataBound="DataBoundList">

    <LayoutTemplate>

    <table>

    <thead>

    <tr>

    <th>

    </th>

    <th>

    REG

    </th>

    </tr>

    </thead>

    <tbody id="ItemPlaceHolder" runat="server">

    </tbody>

    <tfoot>

    <tr>

    <th style="text-align: left">

    <asp:LinkButton ID="NewButton" runat="server" Text="New" OnClick="NewButton_Click" />

    </th>

    <th colspan="8" style="text-align: right">

    <%--<cc1Stick out tongueager id="dpCustomers" runat="server" onpagechange="dpCustomers_PageChange"

    slidersize="5" showfirstandlast="false" showpreviousandnext="true" previoustext="<"

    nexttext=">" />--%>

    </th>

    </tr>

    </tfoot>

    </table>

    </LayoutTemplate>

    <ItemTemplate>

    <tr>

    <td>

    <asp:LinkButton ID="DeleteButton" CommandName="Delete" CommandArgument='<%# Eval("M_ID")%>'

    runat="server" Text="Delete"></asp:LinkButton>

    <asp:LinkButton ID="EditButton" CommandName="Edit" runat="server" Text="Edit"></asp:LinkButton>

    </td>

    <td>

    <asp:Label ID="REGLabel" runat="server" Text='<% #Eval("REG")%>'></asp:Label>

    </td>

    <td>

    </tr>

    </ItemTemplate>

    <AlternatingItemTemplate>

    <tr class="odd">

    <td>

    <asp:LinkButton ID="DeleteButton" CommandName="Delete" CommandArgument='<%# Eval("M_ID")%>'

    runat="server" Text="Delete"></asp:LinkButton>

    <asp:LinkButton ID="EditButton" CommandName="Edit" runat="server" Text="Edit"></asp:LinkButton>

    </td>

    <td>

    <asp:Label ID="REGLabel" runat="server" Text='<% #Eval("REG")%>'></asp:Label>

    </td>

    </tr>

    </AlternatingItemTemplate>

    <InsertItemTemplate>

    <tr>

    <td colspan="9">

    <table>

    <tbody>

    <tr>

    <th>

    REG:

    </th>

    <td>

    <asp:Label ID="M_IDTextBox" Visible="false" runat="server" Text='<% #Bind("M_ID")%>' />

    <asp:DropDownList ID="REGDropDownList" DataValueField="RegName" DataTextField="RegID" runat="server" Text='<% #Bind("REG")%>' ValidationGroup="add"/>

    </td>

    </tr>

    <tr>

    <th>

    FLT IN:

    </th>

    <td>

    <asp:DropDownList ID="FLTINDropDownList" runat="server" Text='<% #Bind("FLTIN")%>' ValidationGroup="add" />

    </td>

    </tr>

     

    <td>

    <asp:LinkButton ID="InsertButton" CommandName="Insert" runat="server" Text="Save"

    ValidationGroup="add"></asp:LinkButton>

    <asp:LinkButton ID="CancelButton" CommandName="Cancel" runat="server" Text="Cancel"

    CausesValidation="false"></asp:LinkButton>

    </td>

    </tr>

    </tbody> </table> </td> </tr>

    </InsertItemTemplate>

    <EmptyDataTemplate>

    There is no data at this time!

    <table>

    <tfoot>

    <tr>

    <th style="text-align: left">

    <asp:LinkButton ID="NewButton" runat="server" Text="New" OnClick="NewButton_Click" />

    </th>

    </tr>

    </tfoot>

    </table>

    </EmptyDataTemplate>

    </asp:ListView>

     

    Thanks

    Aish MM

     

     

     

     

     

     

    Wednesday, March 5, 2008 1:05 PM