2017-07-03 63 views
0

我在頁面上有多個選項卡,當前我在頁面加載時綁定了每個選項卡上的所有下拉列表。如何將onClick事件添加到asp.net中的HTML單選按鈕

我想僅在選擇選項卡時綁定下拉列表。我也想在選項卡更改時清除gridviews。

這是我的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>

+1

你試過了什麼?你也可以縮進你的HTML –

+0

固定代碼格式。 – phd

回答

0

Himani嗨,嘗試這樣的 -

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

在Javascript中 -

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

謝謝:)

+0

我試過了,它仍然沒有工作。我也嘗試在onclick事件中將gridview的數據源設置爲null。 –

+0

請編寫你的代碼你在javascript中寫什麼? –

相關問題