Principales respuestas
Extenciones AJAX Scriptmanager y Updatepanel

Pregunta
-
Buenod dias tengo dos paginas en donde tienen controles y eventos, checkbox GreadVew listvew y siempre que hago un evento hago click, o actualizo algo se refresca la pagina y si por ejemplo me encuentro al final de ella la barra de desplazamiento me pone de nuevo arriba en el boton que estoy haciendo click ya que se refresca, vi y leí que la solución a esto son los controles ajax Scriptmanager y updatepanel pero realmente no se en donde ponerlos en mi aspx para que no ocurra eso, se que el updatepanel se pone despues de scriptmanager
el codido de mi aspx es el siguiente:
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<br />
<br />
<img alt="" class="auto-style18" longdesc="http://localhost:56313/home.png" src="home.png" /><asp:HyperLink ID="HyperLink3" runat="server" NavigateUrl="WebForm1.aspx" Font-Names="Arial" >Home</asp:HyperLink>
<table class="auto-style1" border="0" >
<tr>
<td> </td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td class="auto-style14" colspan="4"><asp:Label ID="Label12" runat="server" Text="Label" Width="874px" Font-Bold="True" Font-Names="Arial" Font-Size="X-Large" CssClass="auto-style17"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style5" style="font-family: Arial, Helvetica, sans-serif"><strong>Socio</strong></td>
<td class="auto-style8" style="font-family: Arial, Helvetica, sans-serif">
<asp:Label ID="Label1" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style7" style="font-family: Arial, Helvetica, sans-serif"><strong style="font-family: Arial, Helvetica, sans-serif">Nit</strong></td>
<td class="auto-style6" style="font-family: Arial, Helvetica, sans-serif">
<asp:Label ID="Label7" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style19" style="font-family: Arial, Helvetica, sans-serif"><strong style="font-family: Arial, Helvetica, sans-serif">Sector</strong></td>
<td class="auto-style20" style="font-family: Arial, Helvetica, sans-serif">
<asp:Label ID="Label2" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style21" style="font-family: Arial, Helvetica, sans-serif"><strong style="font-family: Arial, Helvetica, sans-serif">Subsector</strong></td>
<td class="auto-style22" style="font-family: Arial, Helvetica, sans-serif">
<asp:Label ID="Label8" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style4"><strong style="font-family: Arial, Helvetica, sans-serif">Fecha de apertura</strong></td>
<td class="auto-style15">
<asp:Label ID="Label3" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style3"><strong style="font-family: Arial, Helvetica, sans-serif">Nacionalidad</strong></td>
<td class="auto-style16">
<asp:Label ID="Label9" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style4"><strong style="font-family: Arial, Helvetica, sans-serif">Ciudad</strong></td>
<td class="auto-style15">
<asp:Label ID="Label4" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style3"><strong style="font-family: Arial, Helvetica, sans-serif">Key account:</strong></td>
<td class="auto-style16">
<asp:Label ID="Label13" runat="server" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style4"><strong style="font-family: Arial, Helvetica, sans-serif">Dirección</strong></td>
<td class="auto-style15">
<asp:Label ID="Label5" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style3"><strong style="font-family: Arial, Helvetica, sans-serif">Teléfono</strong></td>
<td class="auto-style16">
<asp:Label ID="Label10" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style10"><strong style="font-family: Arial, Helvetica, sans-serif">Facturación B&U</strong></td>
<td class="auto-style11">
<asp:Label ID="Label6" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
<td class="auto-style12"><strong style="font-family: Arial, Helvetica, sans-serif">Ventas (Miles COP)</strong></td>
<td class="auto-style13">
<asp:Label ID="Label11" runat="server" Text="Label" Width="337px" Font-Names="Arial" Font-Size="Small"></asp:Label>
</td>
</tr>
</table>
<hr />
<br />
<asp:GridView ID="GridView1" runat="server" Width="1143px" align="Center" CellPadding="4" ForeColor="#333333" GridLines="None" BorderColor="#666666" BorderStyle="Solid" BorderWidth="1px">
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:ButtonField CommandName="Select" HeaderText="Seleccionar" ShowHeader="True" Text="Adicionar..." ButtonType="Image" ImageUrl="~/Check.png" />
</Columns>
<EditRowStyle BackColor="#999999" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#E9E7E2" />
<SortedAscendingHeaderStyle BackColor="#506C8C" />
<SortedDescendingCellStyle BackColor="#FFFDF8" />
<SortedDescendingHeaderStyle BackColor="#6F8DAE" />
</asp:GridView>
<br />
<br />
Estado
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" >
</asp:DropDownList>
Subestado
<asp:DropDownList ID="DropDownList2" runat="server">
</asp:DropDownList>
<asp:Button ID="Button2" runat="server" Text="Actualizar Estado" Width="120px" />
<br />
<br />
Comentario<asp:TextBox ID="TextBox1" runat="server" MaxLength="255" Width="1008px" Enabled="False"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Enviar" />
<br />
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True" Text="Comentario general sobre el cliente" />
<br />
<br />
Comentarios sobre la campaña<br />
<asp:TextBox ID="TextBox3" runat="server" Height="77px" ReadOnly="True" Rows="5" TextMode="MultiLine" Width="1102px"></asp:TextBox>
<br />
<br />
Comentarios sobre el cliente<br />
<asp:TextBox ID="TextBox2" runat="server" Height="77px" ReadOnly="True" Rows="5" TextMode="MultiLine" Width="1102px"></asp:TextBox>
<br />
<img alt="" class="auto-style18" longdesc="http://localhost:56313/home.png" src="home.png" /><asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="WebForm1.aspx" >Home</asp:HyperLink>
<br />
</asp:Content>
en donde me recomendarían ponerlos para que no se refresque y no sea incomodo para el usuario
Respuestas
-
>>vi y leí que la solución a esto son los controles ajax Scriptmanager y updatepanel pero realmente no se en donde ponerlos en mi aspx para que no ocurra eso, se que el updatepanel se pone despues de scriptmanager
el updatepanel se define en aquella seccion que quieres que lance la accion y solo esa se actualice
por ejemplo, si tienes un gridview que pagina podrias definir ese grid unicamente dentro del template del updatepanel para que solo este se actualice y no el resto de la pagina
si tienes combos en cascada podrias abarcar estos en el updatepanel para que solo estos se actualicen
o sea debes acotar el ambito de accion del updatepanel
Introduction to the UpdatePanel Control
saludos
Leandro Tuttini
Blog
MVP Profile
Buenos Aires
Argentina- Propuesto como respuesta Karen MalagónModerator martes, 17 de marzo de 2015 22:38
- Marcado como respuesta Karen MalagónModerator miércoles, 18 de marzo de 2015 17:48