开发者

how to bind the database value to a div?

开发者 https://www.devze.com 2023-01-02 04:49 出处:网络
in my application i want to bind the data to a div, which is in a datalist so how can i bind the value .thank y开发者_Go百科ouUse a Panel that contains a Literal control. The Panel will render as a di

in my application i want to bind the data to a div, which is in a datalist so how can i bind the value .thank y开发者_Go百科ou


Use a Panel that contains a Literal control. The Panel will render as a div and the Literal control renders as text. You will data bind to the Literal control's Text property. This will give you what you want. A div that contains text for each item displayed in a DataList control.

Be creative in combining controls to give you the layout, format, data-binding, and so on that you need. If it gets too complex, create a user-control


use this is very useful

    <ItemTemplate>
    <asp:Label runat="server" ID="lblLocationId" Text='<%#Eval("LocationID") %>' ></asp:Label>

       <asp:Panel Wrap="true" ID="Panel1" Width="140px" Font-Underline="true" Font-Italic="true" ForeColor="Black" ScrollBars="None" runat="server">
       <%-- <div id="div1" runat="server"></div>--%>
        <asp:Literal runat="server" Text='<%#Eval("Solution") %>'>
        </asp:Literal>
        </asp:Panel>
    </ItemTemplate>


Use <%# Eval("Name of your data field") %> to bind to properties in your datasource.

0

精彩评论

暂无评论...
验证码 换一张
取 消