.netでクライアントのhtmlラベルコントロールをサーバ側で取得する方法.

2413 ワード

原理は簡単で、htmlコントロールに対応するサービス側コントロールクラスを通じて.
クラス#クラス#
タブ
HtmlAnchor
<a>
HtmlButton
<button>
HtmlSelect
<select>
HtmlTextArea
<textarea>
HtmlInputButton
<input type="button">
HtmlInputCheckBox
<input type="check">
HtmlInputRadioButton
<input type="radio">
HtmlInputText
<input type=“text”>および<input type=“password”>
HtmlInputHidden
<input type="hidden">
HtmlInputImage
<input type="image">
HtmlInputFile
<input type="file">
HtmlForm
<form>
HtmlImage
<img>
HtmlTable
<table>
HtmlTableRow
<tr>
HtmlTableCell
<td>
HtmlGenericControl
他のコントロールがないタグは、
例えば<span>、<div>等
注意:サーバ側で処理するhtmlタグにはRunat=「server」属性を付ける必要があります.
以下のコードXX.aspxページ:
<body>
    <form id="form1" runat="server">
    <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="ListView.DataClasses1DataContext"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName=""
        TableName="tbl_stock_dtl">
    </asp:LinqDataSource>
    <input id="Button1" type="button" value="button" runat="server" />
    <div>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="LinqDataSource1" OnItemDataBound="Repeater1_ItemDataBound">
            <HeaderTemplate>
                <table>
            </HeaderTemplate>
            <ItemTemplate>
                <tr>
                    <td>
                        <%#Eval("part_code") %>
                    </td>
                    <td>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%#Eval("stock_num") %>'></asp:TextBox>
                    </td>
                </tr>
            </ItemTemplate>
            <FooterTemplate>
                </table></FooterTemplate>
        </asp:Repeater>
    </div>
    </form>
</body>

サーバ側でおよび