Monday, January 25, 2010

Use of three dropdown in Ajax

<asp:UpdatePanel id=”UpdatePanel1″ runat=”server” UpdateMode=”Conditional”>
<contenttemplate>
<asp:DropDownList width=”250px”  id=”drpmaincategory” runat=”server” OnSelectedIndexChanged=”drpmaincategory_SelectedIndexChanged” AutoPostBack=”true” >
</asp:DropDownList>  <asp:RequiredFieldValidator ID=”RequiredFieldValidator3″ runat=”server”
ControlToValidate=”drpmaincategory” ErrorMessage=”Please Select Category” Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblmaincategory” runat=”server” Text=”"></asp:Label></TD>
<asp:DropDownList id=”drpsubcategory” width=”250px” runat=”server” OnSelectedIndexChanged=”drpsubcategory_SelectedIndexChanged1″ AutoPostBack=”true” CssClass=”textfield”>
</asp:DropDownList> <asp:RequiredFieldValidator ID=”RequiredFieldValidator2″ runat=”server”
ControlToValidate=”drpsubcategory” ErrorMessage=”Please Select Subcategory”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblsubcategory” runat=”server” Text=”"></asp:Label></TD>
<asp:DropDownList id=”drpproductname” width=”250px” runat=”server”>
</asp:DropDownList><asp:RequiredFieldValidator ID=”RequiredFieldValidator1″ runat=”server”
ControlToValidate=”drpproductname” ErrorMessage=”Please Select Product”
Display=”Dynamic”>*</asp:RequiredFieldValidator>
<asp:Label ID=”lblproduct” runat=”server” Text=”"></asp:Label></TD>
</contenttemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID=”drpmaincategory” EventName=”SelectedIndexChanged” />
<asp:AsyncPostBackTrigger ControlID=”drpsubcategory” EventName=”SelectedIndexChanged” />
</triggers>
</asp:UpdatePanel>