Ciao
stò studiando i controlli Aiax ( premetto che è la prima volta che li uso).
Ho creato una pagina con un Repeater all'interno di un UpdatePanel. Lo scopo sarebbe di evitare l'aggiornamento del reapeter alla pressione dei button contenuti al suo interno.
Ma non mi riesc, credevo che bastasse indicare l'opzione , almeno così mi sembrava di aver capito dalla guida che ho seguito. Mi sfugge qualcosa?
Vi posto un po di codice per capire:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Repeater ID="MyRepeater" runat="server" OnItemCommand="MyRepeater_onItemCommand" onItemDataBound="MyRepeater_ItemDataBound" >
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
......mio testo repeater..............
<asp:Button ID="Button2" CommandName="piu" runat="server" CommandArgument=<%#DataBinder.Eval(Container.DataItem, "id") %> Text="+" BackColor="#CC0000"
BorderColor="#FF5050" ForeColor="White" Height="25px"/>
<asp:Button ID="Button3" CommandName="meno" runat="server"
CommandArgument=<%#DataBinder.Eval(Container.DataItem, "id") %> Text="-" BackColor="#CC0000"
BorderColor="#FF5050" ForeColor="White" Height="25px"/></small></p></li>
<li class="grid_2-right">
<asp:Button ID="MyButton" CommandName="Ordina" runat="server"
CommandArgument=<%#DataBinder.Eval(Container.DataItem, "id") %> Text="Ordina" PostbackUrl='<%# "#elemento" + DataBinder.Eval(Container.DataItem, "idS")%>' />
............altro testo reapeter........................................
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
Nella parte codice ho questo :
Public Sub MyRepeater_onItemCommand(ByVal Sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs)
Dim pippo As String
pippo = e.CommandArgument
Dim id As String = e.CommandArgument.ToString
Dim testo As String = "testo_" & id
'valore della variabile ricevuta
Dim testo_value As String = Request.Form(testo)
Dim comando As String = e.CommandName.ToString
If comando = "piu" Then
Dim textbox = TryCast(e.Item.FindControl("Text1"), System.Web.UI.HtmlControls.HtmlInputText)
Dim test As String = textbox.Value
textbox.Value = test + 1
If textbox IsNot Nothing Then
textbox.Focus() 'set the focus of the control through it's cursor
End If
ElseIf comando = "meno" Then
Dim textbox2 = TryCast(e.Item.FindControl("Text1"), System.Web.UI.HtmlControls.HtmlInputText)
Dim test2 As String = textbox2.Value
If test2 = "0" Then
textbox2.Value = "0"
Else
textbox2.Value = test2 - 1
End If
If textbox2 IsNot Nothing Then
textbox2.Focus() 'set the focus of the control through it's cursor
End If
ElseIf comando = "Ordina" Then
Dim textbox3 = TryCast(e.Item.FindControl("Text1"), System.Web.UI.HtmlControls.HtmlInputText)
If textbox3 IsNot Nothing Then
textbox3.Focus() 'set the focus of the control through it's cursor
End If
SalvaOrdine(id, testo_value)
cercaTotaleOrdine()
End If
come faccio a fare in modo che al postback successivo della pagina web il panello non si aggiorni e resti fermo e invariato?