InterviewSolution
Saved Bookmarks
| 1. |
How can we cache multiple responses from a single Web form? |
|
Answer» We can cache multiple response from a single web form by using any one of the attributes from VaryByParam, VaryByHeaders or VaryByCustom attributes. Example: If we want display different COUNTRY data on our page where we can CHOOSE country name from the drop down list. On SelectedIndexChanged event of the Drop down we have to write some LOGIC to FETCH the country data according to the selected value and display the data of the particular country. By setting the VaryByParam attribute to the dropdown will cache all the responses received from server on SelectedIndexChanged event of drop down. <%@ OutputCache DURATION="20" Location="Server" VaryByParam="countryDropDown%> <aspx:DropDownList ID="countryDropDown" AutoPostBack="true" runat="server" onselectedindexchanged=" countryDropDown _SelectedIndexChanged"> <asp:ListItem Text="Germany" Value=" Germany "></asp:ListItem> <asp:ListItem Text="Singapore" Value=" Singapore "></asp:ListItem> <asp: ListItem Text="India" Value=" India "></asp: ListItem> </asp:DropDownList> |
|