CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 10/23/2005 5:58:01 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 6 Views: 236 Favorited: 0 Favorite
7 Items, 1 Pages 1 |< << Go >> >|
luquantes
Asp.Net User
LinkButton OnClick event not firing!10/23/2005 5:58:01 PM

0

I am working on a custom control about dynamic category. Code is like that

--- This code work ---
    Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
        RaiseEvent OnNodeClick(eventArgument)
    End Sub

    Private Sub AddChildCategory(ByVal id As Int64, ByVal description As String)
        Dim link As New Button
        link.Text = description
        link.Width = Me.Width
        link.Attributes.Add("OnClick", Page.GetPostBackEventReference(Me, Str(id)))
        AddItem(link, "grid_item")

    End Sub

--- But this doesn't work

    Public Sub RaisePostBackEvent(ByVal eventArgument As String) Implements System.Web.UI.IPostBackEventHandler.RaisePostBackEvent
        RaiseEvent OnNodeClick(eventArgument)
    End Sub

    Private Sub AddChildCategory(ByVal id As Int64, ByVal description As String)
        Dim link As New LinkButton  'I changed object from Button to LinkButton
        link.Text = description
        link.Width = Me.Width
        link.Attributes.Add("OnClick", Page.GetPostBackEventReference(Me, Str(id)))
        AddItem(link, "grid_item")

    End Sub
----------------------------------------------------------------------
if i use Button object
When click on Button.. RaisePosBackEvent can firing.. there is no problem

but i use LinkButton object
When click on LinkButton.. RaisePosBackEvent can't firing.. what is the problem..??





luquantes
Asp.Net User
Re: LinkButton OnClick event not firing!11/2/2005 9:53:19 AM

0

i couldn't solve this..
stevenbey
Asp.Net User
Re: LinkButton OnClick event not firing!11/2/2005 2:54:19 PM

0

Can you post the HTML markup that is being produced for each example?


Steven Bey

Recursion: see Recursion
luquantes
Asp.Net User
Re: LinkButton OnClick event not firing!11/2/2005 6:25:50 PM

0

This HTML block is LinkButton's
    <tr>
    <td class=""><a id="Link0" OnClick="JavaScript:__doPostBack('CategoryList1',' 0')" href="javascript:__doPostBack('Link0','')" style="color:White;background-color:SteelBlue;border-style:Solid;width:224px;">Products</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link1" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 1')" href="javascript:__doPostBack('Link1','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category1</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link2" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 2')" href="javascript:__doPostBack('Link2','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category2</a></td>
    </tr><tr>
    <td class="grid_item"><a id="Link3" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 3')" href="javascript:__doPostBack('Link3','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category3</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link4" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 4')" href="javascript:__doPostBack('Link4','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category4</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link5" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 5')" href="javascript:__doPostBack('Link5','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category5</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link6" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 6')" href="javascript:__doPostBack('Link6','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category6</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link7" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 7')" href="javascript:__doPostBack('Link7','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category7</a></td>
    </tr><tr>
        <td class="grid_item"><a id="Link8" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 8')" href="javascript:__doPostBack('Link8','')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;">Category8/a></td>
    </tr>

----------------------------------------------------------------------------------------------------------------------------------------
This HTML block is Button's
    <tr>
    <td class=""><input type="submit" name="Link0" value="Products" id="Link0" OnClick="JavaScript:__doPostBack('CategoryList1',' 0')" style="color:White;background-color:SteelBlue;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link1" value="Category1" id="Link1" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 1')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link2" value="Category2" id="Link2" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 2')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link3" value="Category3" id="Link3" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 3')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link4" value="Category4" id="Link4" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 4')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link5" value="Category5" id="Link5" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 5')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link6" value="Category6" id="Link6" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 6')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link7" value="Category7" id="Link7" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 7')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr><tr>
        <td class="grid_item"><input type="submit" name="Link8" value="Category8" id="Link8" align="left" OnClick="JavaScript:__doPostBack('CategoryList1',' 8')" style="color:OrangeRed;background-color:White;border-style:Solid;width:224px;" /></td>
    </tr>


stevenbey
Asp.Net User
Re: LinkButton OnClick event not firing!11/3/2005 1:58:40 PM

0

If you look at the LinkButton code you will see that there is a conflict between the href and onclick.


Steven Bey

Recursion: see Recursion
fpendino
Asp.Net User
Re: LinkButton OnClick event not firing!12/20/2007 7:06:21 PM

0

I'm having a simliar problem to this.  I've tried the solution in this, but it is not working either.

I have a LinkButton that is dynamically added through a seperate class file.  The LinkButton itself is it's own class as well.

 Here's what I have.  These and some other controls are being inputted onto the page during the Render event which is overriden in the seperate class file.

Any Suggestions?????!!!

Private Sub AddAlphabeticPagingRow(ByVal output As System.Web.UI.HtmlTextWriter)

        Dim pnlDiv As New Panel
        Dim rptData As New Repeater
       
        pnlDiv.ID = "divAlphaPaging"
        pnlDiv.RenderBeginTag(output)

        Dim i As Integer

        Dim lc As LiteralControl
     

        Dim l As BAMAlphaPagingLink
        For i = 65 To 65 + 25
            l = New BAMAlphaPagingLink
            lc = New LiteralControl
         

            lc.Text = " | "
            l.ID = "lnkAlpha" & Chr(i)
            l.Text = Chr(i)
            l.EnableViewState = True

            l.Attributes.Add("href", "Javascript:" + Page.GetPostBackEventReference(l, Chr(i)))
            ' l.Attributes.Add("onClick", "Page.GetPostBackEventReference(l, Chr(i)))

         
            l.RenderControl(output)
            lc.RenderControl(output)
           

           
        Next

       
        pnlDiv.RenderEndTag(output)

    End Sub


'''''Heres the class for the LinkButton'''
Public Class BAMAlphaPagingLink
    Inherits System.Web.UI.WebControls.LinkButton
    'Implements System.Web.UI.IPostBackEventHandler

    Public Sub New()
        MyBase.New()

    End Sub

#Region " Propterties "


#End Region

    Public Event PagingLinkClicked As EventHandler
    Public Sub RaisePostBackEvent()
        'Implements IPostBackEventHandler.raisepostbackevent
        OnPagingLinkClicked(New EventArgs)

    End Sub

    Protected Overridable Sub OnPagingLinkClicked(ByVal e As EventArgs)
        If (PagingLinkClickedEvent Is Nothing) Then
            RaiseEvent PagingLinkClicked(Me, e)
        End If
    End Sub




End Class

 
nkahootz
Asp.Net User
Re: LinkButton OnClick event not firing!1/9/2008 10:34:18 PM

0

To add the click event to an object, try this syntax:

Label lb = new Label();

lb.ID = "myNewLabel";

lb.Click += new System.EventHandler(this.UpdateItem_Click);

 

 Hope that helps!

7 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006
Pro ASP.NET 2.0 Website Programming Authors: Damon Armstrong, Pages: 641, Published: 2005
Building Web Solutions with ASP.NET and ADO.NET Authors: Dino Esposito, Pages: 379, Published: 2002
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 in C# 2005: Create Next-generation Web Applications with the Latest Version of Microsoft's Revolutionary Technology Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1426, Published: 2006
Pro Asp.net 3.5 in Vb 2008: Includes Silverlight 2 and the Ado.net Entity Framework Authors: Matthew MacDonald, Mario Szpuszta, Vidya Vrat Agarwal, Pages: 1200, Published: 2008
Netscape Navigator 3: Browsing and Beyond Authors: William P. Mann, Bill Mann, Pages: 381, Published: 1996
Visual Basic .NET: Your Visual Blueprint for Building Versatile Programs on the .NET Framework Authors: Richard Bowman, MaranGraphics, Pages: 352, Published: 2002

Web:
LinkButton OnClick event not firing! - ASP.NET Forums
OnClick event not firing from LinkButton : ASP.NET, c##, I.E 6.0 Sep 23, 2008 ... Dear EE Community, I am experiencing a problem with a user control object. This is what I...
Asp.Net Programming :: onClick Event Not Firing I'm new to C# and need some help regarding an onClick event not firing. ... because the link button is not visible, it not rendered. thus it knows ...
LinkButton click, refresh the page button, refresh the web-page it does not fire the onClick event of the link button. I don't want the link button's onClick event to fire ...
Dynamically created Linkbutton onclick not working... and then trying to hook up the click event handler... but it's not working. ... Validation jscript not firing on the deployment site ...
Linkbuttons click event not firing, ASP.NET & Web Development, C# ... Oct 17, 2008 ... NET 2.0 and I'm having problems where linkbuttons click events on certain pages are not firing on my TEST server. They are firing fine while ...
onClick Event Not Firing - bytes I'm new to C# and need some help regarding an onClick event not firing. I have a data grid that I add a cell to programatically. ...
Event not firing for user control inside user control control, the event on the linkbutton does not fire. .... IPostBackEventHandler because you define the method OnClick in the control ...
Click event not firing after refresh - VBForums Click event not firing after refresh ASP.NET. ... it seems as if focus was now given to the table to generate the linkbutton click event. ...
Link Button Click event & Page Postback does not fire. - Extend It ... DotNetNuke Forums. Forum ยท General DotNetN... Extend It! ( Pr... Link Button Click event & Page Postback does not fire. ...






composite controls position

databinding checkboxlists

enhanced listitem...

calendar and sqldatabase properties question

metabuilders.com combobox - how to retrieve value

adding child controls to a custom control

outputting html on control render

arraylist as datasource for datagrid

problem with email control... need some help with regular expressions

help-creating user control for left side menu that spans the whole page.

hosting asp.net

just starting out looking for good hosting company

dispose (by the book) causes infinite loop!

hosting website

custom control won't render in design-time!?

composite control loses text over postback

programatically putting space between multiple controls in a custom control

custom controls and localization

reusing a property from several derived classes?

setting the left and top style properties while in design mode.

validation control based on presence of string value

custom controls and postback

click event on panel

visible attribute

tagprefix and mulitple namespaces problem

regularexpressionvalidator problem while creating control

good hosting server that allows reportviewer control

hi - opinions on this list of 3 hosts?

hosting accounts

looking for reliable hosting service. suggestions please.

   
  Privacy | Contact Us
All Times Are GMT