`我有一个带有复选框的Gridview。网格是根据两个下拉列表的值加载的。下拉列表中的值基于Web服务加载。
现在我的问题是,当选中该复选框时,刷新页面并将dropdownlist中的值设置为default。也就是说,在刷新页面的任何情况下,dropdownlists值都设置为default。只有下拉列表值更改,其他字段值保持不变。我尝试使用updatepanel但它没有工作。
任何帮助都将非常感激。
<td>
<asp:DropDownList ID="ddl_Prov" CssClass="txtboxAll" Width="260px"
runat="server"> </asp:DropDownList>
<asp:CascadingDropDown ID="CascadingDropDown1" runat="server"
Category="facil" TargetControlID="ddl_Prov" PromptText="[SelectGroup]"
LoadingText="Loading Group..." ServicePath="~/Services/eservice.asmx"
ServiceMethod="GetDropDownProgroup"></asp:CascadingDropDown>
</td>
<td>
<asp:DropDownList ID="ddl_Pro" CssClass="txtboxAll" Width="260px"
runat="server" ></asp:DropDownList>
<asp:CascadingDropDown ID="cdd_fa" runat="server" Category="facility"
ParentControlID="ddl_Prov" TargetControlID="ddl_Pro"
PromptText="[Select Pr]" LoadingText="Loading Provider..."
ServicePath="~/Services/Freservice.asmx"
ServiceMethod="GetDropDownFacilitybyGr">
</asp:CascadingDropDown>
</td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"
UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="grd_ViewPayments" DataKeyNames="IN077_01"
runat="server" Width="100%"
DataSourceID="SqlDataSource1" AllowPaging="true"
showfooter="true" PageSize="20" AutoGenerateColumns="False"
OnSelectedIndexChanged="grd_ViewPayments_SelectedIndexChanged"
OnRowDataBound="grd_ViewPayments_RowDataBound">
<SelectedRowStyle BackColor="#D8E4F2" />
<HeaderStyle cssclass="Header" />
<FooterStyle cssclass="Header" HorizontalAlign="Center" />
<RowStyle cssclass="rowsgrd" />
<HeaderStyle cssclass="Header" />
<PagerSettings FirstPageText="First" LastPageText="Last" Mode="NumericFirstLast" PageButtonCount="3" position="Bottom" />
<PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" BorderColor="#36b0b6" BorderStyle="Dotted" BorderWidth="1px" BackColor="#E1E1E1" />
<Columns>
<asp:TemplateField HeaderStyle-HorizontalAlign="Center" HeaderText="SlNo."
ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30px">
<ItemTemplate>
<%# Container.DataItemIndex + 1%>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="3%" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:BoundField DataField="pid" HeaderText="VID"
SortExpression="pid" >
<ItemStyle HorizontalAlign="Center" Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="pname" HeaderText="Pr Name" ItemStyle-HorizontalAlign="Left"
SortExpression="pname">
<ItemStyle HorizontalAlign="Center" Width="150px" />
</asp:BoundField>
<asp:BoundField DataField="amount" HeaderText="Amount" ItemStyle-HorizontalAlign="Center"
SortExpression="amount" >
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:BoundField>
<asp:BoundField DataField="date" HeaderText="Date" DataFormatString="{0:dd-MMM-yyyy}" ItemStyle-HorizontalAlign="Center"
SortExpression="date" >
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:BoundField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="3%">
<HeaderTemplate>
<asp:CheckBox ID="chk_All" runat="server" AutoPostBack="True" oncheckedchanged="chk_All_CheckedChanged" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chk_select" OnCheckedChanged="chk_select_CheckedChanged" AutoPostBack="True" runat="server" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="3%" />
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NCPConnectionString %>"
SelectCommand="SPPS_1" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="ddl_Prov" DefaultValue="All"
Name="pro1" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="ddl_Pro" DefaultValue="All"
Name="pr" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="but_search" EventName="Click" />
<asp:PostBackTrigger ControlID="grd_ViewPayments" />
</Triggers>
</asp:UpdatePanel>