开发者

i wanna do it without autopost back i create a toggle button using asp.net image button !

i want to do it without page refresh .....

Protected Sub s1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles s1.Click
        If s1.ImageUrl = "~/selected.gif" Then
            s1.ImageUrl = "~/available.gif"
            TextBox1.Text = TextBox1.Text.Replace("1", "")
        ElseIf s1.ImageUrl = "~/available.gif" Then
            s1.ImageUrl = "~/selected.gif"
            TextBox1.Text = TextBox1.Text.ToSt开发者_C百科ring() & "," & "1"
        End If
    End Sub


I think you can use UpadatePanel. Example (assuming your controls are not scattered):

<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:Image ID="imgToggleImage" runat="server" />
                <asp:Button ID="s1" runat="server" Text="Button"/>
            </ContentTemplate>
        </asp:UpdatePanel>

And then can have the required code in code behind.


If I am not wrong, you want to change image of s1 button when s1 is clicked and change some textbox contents. If you want to do it without postback, use javascript.

See an example here to get you started: http://www.toknowmore.net/e/1/javascript/change-image-onclick.php#

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜