如何将onClick事件添加到asp.net中的HTML单选按钮

时间:2017-07-03 10:33:49

标签: html asp.net

我的页面上有多个标签,目前我在页面加载时绑定每个标签上的所有下拉列表。

我想仅在选中选项卡时绑定下拉列表。我还希望在更改选项卡时清除网格视图。

这是我的HTML代码



<li>
   <input type="radio" id="tab1d"  name="tabs1" runat="server"/>
   <label for="tab1d">Search</label>
   <div id="tab-content1d" class="tab-content animated fadeIn" style="background-color:white; padding:10px; ">
       <asp:UpdatePanel ID="UpdatePanel1" runat="server">
           <ContentTemplate>
               <asp:Label ID="Label4" runat="server" Text="Select Platform"></asp:Label>&nbsp;&nbsp;&nbsp;
               <asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged" CssClass="inputs" Width="150px"></asp:DropDownList>&nbsp;&nbsp;&nbsp;
               <asp:Label ID="Label10" runat="server" Text="Select Family Name"></asp:Label>&nbsp;&nbsp;&nbsp;
               <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" CssClass="inputs" Width="150px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged"></asp:DropDownList>&nbsp;&nbsp;&nbsp;
               <asp:Label ID="Label11" runat="server" Text="Select price Level"></asp:Label>&nbsp;&nbsp;&nbsp;
               <asp:DropDownList ID="DropDownList2" runat="server"  AutoPostBack="true" CssClass="inputs" Width="150px" ></asp:DropDownList>&nbsp;&nbsp;&nbsp;
               <asp:Button ID="Button7" runat="server" Text="Search" CssClass="buttons" OnClick="Button7_Click"/><br /><br />
               <div id="gdvLeft">
                   <asp:GridView ID="gdvFamilyname" runat="server" EnableViewState="True" class="grid" RowStyle-CssClass="rows"></asp:GridView>
               </div>
               <div id="gdvRight">
                   <asp:GridView ID="gdvQuantity" runat="server" EnableViewState="True"  class="grid" RowStyle-CssClass="rows"></asp:GridView>
               </div>
           </ContentTemplate>
       </asp:UpdatePanel>
   </div>
   </li>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

嗨Himani,试试这个 -

<input type="radio" value="Click Me" onclick="rdioClick();" />

在Javascript中 -

function rdioClick() {
            var GridView1 = document.getElementById('GridView1');
            GridView1.innerHTML = "";
        }

谢谢:)