如何获得HTML控件的HTML表单表中的服务器端,asp.net [英] How to get html controls form html table in server side,asp.net

查看:115
本文介绍了如何获得HTML控件的HTML表单表中的服务器端,asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何机构可以告诉我,我怎样才能获得HTML控件在asp.net的HTML表单表中的服务器端?
 我的code是这样的。

Can any body tell me how can i get html controls form html table in server side in asp.net? My code goes like this.

 <div>
    <table runat='server' id="CheckBoxList1">
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_1' type='checkbox' name='CheckBoxList1$1'
                    value='1' /><label for='CheckBoxList1_1'>1</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_22' type='checkbox' name='CheckBoxList1$22'
                    value='1' /><label for='CheckBoxList1_22'>22</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_43' type='checkbox' name='CheckBoxList1$43'
                    value='1' /><label for='CheckBoxList1_43'>43</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_2' type='checkbox' name='CheckBoxList1$2'
                    value='1' /><label for='CheckBoxList1_2'>2</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_23' type='checkbox' name='CheckBoxList1$23'
                    value='1' /><label for='CheckBoxList1_23'>23</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_44' type='checkbox' name='CheckBoxList1$44'
                    value='1' /><label for='CheckBoxList1_44'>44</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_3' type='checkbox' name='CheckBoxList1$3'
                    value='1' /><label for='CheckBoxList1_3'>3</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_24' type='checkbox' name='CheckBoxList1$24'
                    value='1' /><label for='CheckBoxList1_24'>24</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_45' type='checkbox' name='CheckBoxList1$45'
                    value='1' /><label for='CheckBoxList1_45'>45</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_4' type='checkbox' name='CheckBoxList1$4'
                    value='1' /><label for='CheckBoxList1_4'>4</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_25' type='checkbox' name='CheckBoxList1$25'
                    value='1' /><label for='CheckBoxList1_25'>25</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_46' type='checkbox' name='CheckBoxList1$46'
                    value='1' /><label for='CheckBoxList1_46'>46</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_5' type='checkbox' name='CheckBoxList1$5'
                    value='1' /><label for='CheckBoxList1_5'>5</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_26' type='checkbox' name='CheckBoxList1$26'
                    value='1' /><label for='CheckBoxList1_26'>26</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_47' type='checkbox' name='CheckBoxList1$47'
                    value='1' /><label for='CheckBoxList1_47'>47</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_6' type='checkbox' name='CheckBoxList1$6'
                    value='1' /><label for='CheckBoxList1_6'>6</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_27' type='checkbox' name='CheckBoxList1$27'
                    value='1' /><label for='CheckBoxList1_27'>27</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_48' type='checkbox' name='CheckBoxList1$48'
                    value='1' /><label for='CheckBoxList1_48'>48</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_7' type='checkbox' name='CheckBoxList1$7'
                    value='1' /><label for='CheckBoxList1_7'>7</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_28' type='checkbox' name='CheckBoxList1$28'
                    value='1' /><label for='CheckBoxList1_28'>28</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_49' type='checkbox' name='CheckBoxList1$49'
                    value='1' /><label for='CheckBoxList1_49'>49</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_8' type='checkbox' name='CheckBoxList1$8'
                    value='1' /><label for='CheckBoxList1_8'>8</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_29' type='checkbox' name='CheckBoxList1$29'
                    value='1' /><label for='CheckBoxList1_29'>29</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_50' type='checkbox' name='CheckBoxList1$50'
                    value='1' /><label for='CheckBoxList1_50'>50</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_9' type='checkbox' name='CheckBoxList1$9'
                    value='1' /><label for='CheckBoxList1_9'>9</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_30' type='checkbox' name='CheckBoxList1$30'
                    value='1' /><label for='CheckBoxList1_30'>30</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_51' type='checkbox' name='CheckBoxList1$51'
                    value='1' /><label for='CheckBoxList1_51'>51</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_10' type='checkbox' name='CheckBoxList1$10'
                    value='1' /><label for='CheckBoxList1_10'>10</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_31' type='checkbox' name='CheckBoxList1$31'
                    value='1' /><label for='CheckBoxList1_31'>31</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_52' type='checkbox' name='CheckBoxList1$52'
                    value='1' /><label for='CheckBoxList1_52'>52</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_11' type='checkbox' name='CheckBoxList1$11'
                    value='1' /><label for='CheckBoxList1_11'>11</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_32' type='checkbox' name='CheckBoxList1$32'
                    value='1' /><label for='CheckBoxList1_32'>32</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_53' type='checkbox' name='CheckBoxList1$53'
                    value='1' /><label for='CheckBoxList1_53'>53</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_12' type='checkbox' name='CheckBoxList1$12'
                    value='1' /><label for='CheckBoxList1_12'>12</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_33' type='checkbox' name='CheckBoxList1$33'
                    value='1' /><label for='CheckBoxList1_33'>33</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_54' type='checkbox' name='CheckBoxList1$54'
                    value='1' /><label for='CheckBoxList1_54'>54</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_13' type='checkbox' name='CheckBoxList1$13'
                    value='1' /><label for='CheckBoxList1_13'>13</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_34' type='checkbox' name='CheckBoxList1$34'
                    value='1' /><label for='CheckBoxList1_34'>34</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_55' type='checkbox' name='CheckBoxList1$55'
                    value='1' /><label for='CheckBoxList1_55'>55</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_14' type='checkbox' name='CheckBoxList1$14'
                    value='1' /><label for='CheckBoxList1_14'>14</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_35' type='checkbox' name='CheckBoxList1$35'
                    value='1' /><label for='CheckBoxList1_35'>35</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_56' type='checkbox' name='CheckBoxList1$56'
                    value='1' /><label for='CheckBoxList1_56'>56</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_15' type='checkbox' name='CheckBoxList1$15'
                    value='1' /><label for='CheckBoxList1_15'>15</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_36' type='checkbox' name='CheckBoxList1$36'
                    value='1' /><label for='CheckBoxList1_36'>36</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_57' type='checkbox' name='CheckBoxList1$57'
                    value='1' /><label for='CheckBoxList1_57'>57</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_16' type='checkbox' name='CheckBoxList1$16'
                    value='1' /><label for='CheckBoxList1_16'>16</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_37' type='checkbox' name='CheckBoxList1$37'
                    value='1' /><label for='CheckBoxList1_37'>37</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_58' type='checkbox' name='CheckBoxList1$58'
                    value='1' /><label for='CheckBoxList1_58'>58</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_17' type='checkbox' name='CheckBoxList1$17'
                    value='1' /><label for='CheckBoxList1_17'>17</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_38' type='checkbox' name='CheckBoxList1$38'
                    value='1' /><label for='CheckBoxList1_38'>38</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_59' type='checkbox' name='CheckBoxList1$59'
                    value='1' /><label for='CheckBoxList1_59'>59</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_18' type='checkbox' name='CheckBoxList1$18'
                    value='1' /><label for='CheckBoxList1_18'>18</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_39' type='checkbox' name='CheckBoxList1$39'
                    value='1' /><label for='CheckBoxList1_39'>39</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_60' type='checkbox' name='CheckBoxList1$60'
                    value='1' /><label for='CheckBoxList1_60'>60</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_19' type='checkbox' name='CheckBoxList1$19'
                    value='1' /><label for='CheckBoxList1_19'>19</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_40' type='checkbox' name='CheckBoxList1$40'
                    value='1' /><label for='CheckBoxList1_40'>40</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_61' type='checkbox' name='CheckBoxList1$61'
                    value='1' /><label for='CheckBoxList1_61'>61</label>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_20' type='checkbox' name='CheckBoxList1$20'
                    value='1' /><label for='CheckBoxList1_20'>20</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_41' type='checkbox' name='CheckBoxList1$41'
                    value='1' /><label for='CheckBoxList1_41'>41</label>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
                <input runat='server' id='CheckBoxList1_21' type='checkbox' name='CheckBoxList1$21'
                    value='1' /><label for='CheckBoxList1_21'>21</label>
            </td>
            <td>
                <input runat='server' id='CheckBoxList1_42' type='checkbox' name='CheckBoxList1$42'
                    value='1' /><label for='CheckBoxList1_42'>42</label>
            </td>
            <td>
            </td>
        </tr>
    </table>
</div>

谢谢
Mohak

Thanks Mohak

推荐答案

ypur的问题是有点不清楚,但我认为这将有助于
对于如。与访问contorl在GridView中,我们可以利用这一点,说如果你把一个隐藏字段内GridView控件与hfone

ypur question is bit unclear, but I think this will help for eg. to access the contorl with in a gridview we can use this, say if you place a hidden field inside gridview with the id of "hfone"

GvRowDataBound事件中
VAR场=(HiddenField)e.Row.FindControl(hfone);

inside GvRowDataBound event var field= (HiddenField)e.Row.FindControl("hfone");

这样你就可以field.value访问值

so you can access the values by field.value

这篇关于如何获得HTML控件的HTML表单表中的服务器端,asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆