VISUAL WEB DEV/ASP.NET VB BUTTON CLICK

Pravesh Singh

Total Post:101

Points:709
Posted by  Pravesh Singh
VB.Net 
 1260  View(s)
Ratings:
Rate this:
Hi Guys

There is a problem with button click event

my line of code as following 

        <asp:Image ID="Image1" runat="server" Height="57px" ImageUrl="~/img/logo.png" 
            Width="36px" />
        <strong>&nbsp;Test</strong> System </h1>
            <form action="" enctype="multipart/form-data" class="pcss3f">
            <header><asp:Label ID="lblOverview" runat="server" Text=""></asp:Label></header>
                <section class="state-normal" style="text-align:center">
                <button type="button" onclick="window.location = 'AddItem.aspx'">Add Work Item</button>
                <button type="button" id="btnMyWork" name="btnMyWork" onclientclick="btnMyWork_Click" runat="server">My Work Items</button>
                <button type="button">Database Stats</button>
                <br>
                </br>
                <asp:Label ID="lblWhoAmI" runat="server" Text=""></asp:Label>
                </section>
<footer><asp:Label ID="lblWhoAmI2" runat="server" Text=""></asp:Label></footer>
    </form>

The button I'm referring to is this:

<button type="button" id="btnMyWork" name="btnMyWork" onclientclick="btnMyWork_Click" runat="server">My Work Items</button>

And here's the VB I'm trying to get it to run:

Protected Sub btnMyWork_Click()
        lblOverview.Text = "Success"
        lblWhoAmI.Text = "Success"
    End Sub

But when I click it, nothing happens. I've tried adding a click handler in the aspx.vb code but the ".click" won't show in the Intelligent.

 Thanks
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: Visual Web Dev/ASP.net VB Button click

    Hi Pravesh,


    That is a html button. You need to use the ASP button control to fire the OnClick event. Something like below:

    <asp:Button id="btnMyWork" onclick="btnMyWork_Click" runat="server" Text="My Work Items" />

    Try it and tell us.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!