Click here to Skip to main content
15,885,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
who can tell me how to get get dropdownlist values in the gridview using jquery while checkbox is checked?
i have no idea how to do it.please help
Posted
Comments
Nandakishore G N 20-Jun-13 0:55am    
paste the code what have you done till now?

<asp:gridview id="gv_orderStatus" autogeneratecolumns="false" emptydatatext="查询无结果" xmlns:asp="#unknown">
Border="1px" AllowPaging="true" AllowSorting="false" OnRowDataBound="gv_orderStatus_RowDataBound"
OnPageIndexChanging="gvPaging_PageIndexChanging" Width="100%" PageSize="30" runat="server">
<%--width="1200px"--%>
<headerstyle height="25px" backcolor="#CCCCFF">
<rowstyle horizontalalign="Center" font-size="13px" forecolor="Black" height="20px">
Width="100%" />
<columns> <%--<asp:boundfield datafield="option_name" headertext="页面">--%>
<asp:templatefield controlstyle-width="200px">
<%--HeaderStyle-BackColor="#66CCFF"HeaderStyle-BackColor="#CCCCFF"--%>
<headertemplate>
<asp:label id="lbpage" class="ESB_Label" text="页面" runat="server">]]>

<itemtemplate>
<%--<asp:dropdownlist id="fullname" runat="server" width="150px">
--%>
<asp:label id="fullname" text="<%# Eval(" fullname")="" %&gt;"="" runat="server">


<%-- <asp:boundfield datafield="option_type" headertext="类型" sortexpression="option_type" headerstyle-backcolor="#66CCFF">--%>
<asp:templatefield controlstyle-width="200px">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<headertemplate>
<asp:label id="lblType" class="ESB_Label" text="类型" runat="server">]]>

<itemtemplate>
<asp:label id="option_type" width="120px" text="<%#Eval(" option_type")="" %&gt;"="" runat="server">

<headerstyle horizontalalign="Center">
<itemstyle horizontalalign="Center" width="150px">

<%-- <asp:boundfield datafield="option_name" headertext="名称" sortexpression="option_name" headerstyle-backcolor="#66CCFF">--%>
<asp:templatefield controlstyle-width="130px" itemstyle-horizontalalign="Center">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<headertemplate>
<asp:label id="lblName" text="名称" class="ESB_Label" runat="server">

<itemtemplate>
<asp:textbox id="option_name" width="100px" text="<%#Bind(" option_name")="" %&gt;"="" cssclass="CC_TextBox_ReadOnly1">
runat="server">
<asp:label id="hidOption_name" text="" runat="server" visible="false" forecolor="Red">

<itemstyle width="100px" horizontalalign="Center">

<%--<asp:boundfield datafield="option_code" headertext="编号" sortexpression="option_code" headerstyle-backcolor="#66CCFF">--%>
<asp:templatefield controlstyle-width="100px">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<headertemplate>
<asp:label id="lblCode" text="编号" class="ESB_Label" runat="server">

<itemtemplate>
<asp:textbox id="option_code" class="optionCode" width="70px" cssclass="CC_TextBox_ReadOnly2">
Text='<%#Bind("option_code")%>' runat="server">

<itemstyle horizontalalign="Right">

<%--<asp:boundfield datafield="option_order" headertext="排序" sortexpression="option_order" headerstyle-backcolor="#66CCFF">--%>
<asp:templatefield controlstyle-width="100px">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<headertemplate>
<asp:label id="lblSort" text="排序" class="ESB_Label" runat="server">

<itemtemplate>
<%-- <asp:label id="option_name" runat="server">--%>
<asp:textbox id="option_order" class="optionOrder" width="70px" cssclass="CC_TextBox_ReadOnly2">
Text='<%#Bind("option_order") %>' Style="text-align: right" runat="server">

<itemstyle horizontalalign="Left">

<%-- <asp:boundfield datafield="flag" headertext="状态">--%>
<asp:templatefield controlstyle-width="100px" footerstyle-horizontalalign="Center">
<headertemplate>
<%--HeaderStyle-BackColor="#66CCFF"--%>
<asp:label id="lbState" class="ESB_Label" text="状态" runat="server">

<itemtemplate>
<asp:dropdownlist id="flag" class="flag" runat="server" cssclass="ESB_Select_100">
Width="70px">
<asp:listitem text="Normal" value="1">
<asp:listitem text="Closed" value="0">



<asp:templatefield controlstyle-width="150px">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<headertemplate>
<%--<asp:checkbox id="selectAll" runat="server" oncheckedchanged="chkAll_CheckedChanged" text="SelectAll Or Cancel">--%>





<asp:label id="label1" class="ESB_Label" runat="server">SelectAll Or Cancel
<%-- <asp:label text="全选或取消" class="ESB_Label" runat="server">--%>

<itemtemplate>
<asp:checkbox id="CheckBox1" width="60px" runat="server">





 
Share this answer
 
Comments
kishore sharma 20-Jun-13 3:33am    
dear Wang,
you have pasted code with the commented code(garbage) ,make sure when you ask question it should be clear so instead of wasting time in understanding question people will spend time to solve it.

Thanks cheeeer.
Your question makes no sense, because there is no such thing as a gridview in the browser, only the table that your server side control generated.

$("#whatever").is(":checked") is how you tell if a checkbox is checked. You need to use a filter to find all checked checkboxes. You don't say if you want the selected value ( I think val() does that ), or all values. Either way, I am not sure you know what jquery is or what it does. Some more information would help. It would help if you tried to do some research and could post some basic code, so we could work out what you are trying to do.
 
Share this answer
 
Comments
Wenpeng Wang 20-Jun-13 1:25am    
<asp:GridView ID="gv_orderStatus" AutoGenerateColumns="false" EmptyDataText="查询无结果"
Border="1px" AllowPaging="true" AllowSorting="false" OnRowDataBound="gv_orderStatus_RowDataBound"
OnPageIndexChanging="gvPaging_PageIndexChanging" Width="100%" PageSize="30" runat="server">
<%--width="1200px"--%>
<HeaderStyle Height="25px" BackColor="#CCCCFF" />
<rowstyle horizontalalign="Center" font-size="13px" forecolor="Black" height="20px"
="" width="100%">
<columns>
<%--<asp:BoundField DataField="option_name" HeaderText="页面" />--%>
<asp:TemplateField ControlStyle-Width="200px">
<%--HeaderStyle-BackColor="#66CCFF"HeaderStyle-BackColor="#CCCCFF"--%>
<HeaderTemplate>
<asp:Label ID="lbpage" class="ESB_Label" Text="页面" runat="server"><%-- --%>
</HeaderTemplate>
<itemtemplate>
<%--<asp:DropDownList id="fullname" runat="server" Width="150px">
--%>
<asp:Label ID="fullname" Text='<%# Eval("fullname") %>' runat="server">


<%-- <asp:BoundField DataField="option_type" HeaderText="类型" SortExpression="option_type" HeaderStyle-BackColor="#66CCFF" />--%>
<asp:TemplateField ControlStyle-Width="200px">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<HeaderTemplate>
<asp:Label ID="lblType" class="ESB_Label" Text="类型" runat="server"><%----%>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="option_type" Width="120px" Text='<%#Eval("option_type") %>' runat="server">

<HeaderStyle HorizontalAlign="Center" />
<itemstyle horizontalalign="Center" width="150px">

<%-- <asp:BoundField DataField="option_name" HeaderText="名称" SortExpression="option_name" HeaderStyle-BackColor="#66CCFF"/>--%>
<asp:TemplateField ControlStyle-Width="130px" ItemStyle-HorizontalAlign="Center">
<%--HeaderStyle-BackColor="#66CCFF"--%>
<HeaderTemplate>
<asp:Label ID="lblName" Text="名称" class="ESB_Label" runat="server">
</HeaderTemplate>
<itemtemplate>
<asp:TextBox ID="option_name" Width="100px" Text='<%#Bind("option_name") %>' CssClass="CC_TextBox_ReadOnly1"
runat="server">
<asp:Label ID="hidOption_name" Text="" runat="server" Visible="false" ForeColor="Red">

<itemstyle width="100px" horizontalalign="Center">

<%--<asp:BoundField DataField="option_code" HeaderText="编号" SortExpression="option_code" HeaderStyle-BackColor="#66CCFF"/>--%>
&
Wenpeng Wang 20-Jun-13 1:27am    
the jquery :
function() {
var chkList = $("#<%=gv_OrderStatus.ClientID%> input[id*='chkAll']:checkbox:checked[name$=CheckBox1]");
var arrayList = new Array();
for (var i = 0; i < chkList.length; i++) {
arrayList.push(chkList[i].value);
}

}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900