Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matti 15 posts 35 karma points
    Mar 22, 2010 @ 12:12
    Matti
    0

    vbscript in template doesn't function as i'd expect :) (umb 4.0.3/iis 7.5)

    Can someone tell me why litTime updates and litStatus doesn't when i click the button on the page? I suppose i've forgot some statement of some kind, but can't figure out whats wrong..

     

    <%@ Master Language="VB" MasterPageFile="/masterpages/Master.master" AutoEventWireup="true" %>
    
    <asp:content ContentPlaceHolderId="Content" runat="server">
    <script runat="server">
    Sub btnSubmit_Click(sender As Object, e As System.EventArgs) Handles btnSubmit.Click
        litStatus.Text = "Hello"
    End Sub
    
    Sub Page_Load()
        litTime.Text = Now()
    End Sub
    </script>
    
    <p><asp:literal id="litTime" runat="server" />
    <asp:literal id="litStatus" runat="server" text="Untouched" /></p>
    
    <table>
        <tr>
            <td>Name:</td><td><asp:textbox runat="server" id="txtName" /></td>
        </tr>
        <tr>
            <td>Email:</td><td><asp:textbox runat="server" id="txtEmail" /></td>
        </tr>
        <tr><td></td><td><asp:button runat="server" id="btnSubmit" text="Send" /></td></tr>
    </table>  
    </asp:content>
  • Stephan Lonntorp 195 posts 212 karma points
    Mar 22, 2010 @ 12:16
    Stephan Lonntorp
    0

    Try adding OnClick="btnSubmit_Click" to your asp:button, and see what happens.

  • Matti 15 posts 35 karma points
    Mar 22, 2010 @ 13:58
    Matti
    0

    Didn't work, but shouldn't "Handles btnSubmit.Click" handle this?

  • Samuele 9 posts 29 karma points
    Mar 22, 2010 @ 14:18
    Samuele
    0

    Try to add

    Friend WithEvents btnSubmit As System.Web.UI.WebControls.Button

    Not sure but it may do the trick. Let me know how this change goes

    Regards
    Sam

  • Matti 15 posts 35 karma points
    Mar 22, 2010 @ 15:44
    Matti
    0
    BC30260: 'btnSubmit' is already declared as 'Protected Dim WithEvents btnSubmit As System.Web.UI.WebControls.Button' in this class.

    So I guess it is declared already :(

    Could it be that the form isn't being posted back because of some ajax-script?

    The page can be seen at http://adrenalinkick.dk/test/kontakt

     

     

  • Matti 15 posts 35 karma points
    Mar 22, 2010 @ 16:18
    Matti
    0

    Worked it out... I had a second asp:button with the postbackurl property set to another page and that seems to have caused the problem.. Also i noticed that when postbackurl is set on any button the viewstate is broken...

    But thanks for your replies anyway :)

  • Samuele 9 posts 29 karma points
    Mar 22, 2010 @ 16:23
    Samuele
    0

    Good to hear you managed to fix it. On my local machine was working ok and couldn't find the reason it wasn't for you..

Please Sign in or register to post replies

Write your reply to:

Draft