Results 1 to 2 of 2

Thread: OnClick Help.

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    OnClick Help.

    Ok, so I'm adding linkbuttons to a page dynamically on page_load.

    I had it to where the link buttons were redirecting to a page with a query string attached. I was attempting to use the AjaxToolKit's AjaxFileUploader and ran into issues with existing query strings.

    So what I'm trying to do now is handle the click event of the linkbutton server side, set 2 session variables and then redirect the page to the same page, but with out appending a querystring so the ajaxfileuploader will work correctly.

    I can't get it to work, period.

    Here is my linkbutton code:

    vb Code:
    1. Dim Lin As New LinkButton
    2.                     Lin.Text = dr("DeptDesc").ToString
    3.                     Lin.CssClass = "deptlink"
    4.                     Lin.ToolTip = CDate(dr("MeetingDate").ToString).ToFileTime.ToString
    5.                     'Lin.OnClientClick
    6.                     Lin.PostBackUrl = "" '"http://localhost:2201/Website1/HTMLPages/AgendaBuildItemManagement.aspx?DeptID=" + dr("SubmitByDept").ToString + "&CourtDate=" + CDate(dr("MeetingDate").ToString).ToFileTime.ToString
    7.                     'Lin.OnClientClick = "Lin_MyCustomCode"
    8.                     Lin.Attributes.Add("OnClick", "Lin_MyCustomCode")
    9.                     Me.DeptsByDate.Controls.Add(Lin)

    Here is the sub to handle the click event:

    vb Code:
    1. Public Sub Lin_MyCustomCode(ByVal sender As Object, ByVal e As System.EventArgs)
    2.         HttpContext.Current.Session("CourtDate") = CType(sender, LinkButton).ToolTip
    3.         JCSrcLib.CommSiteAPI.API.ConnectionString = DBConnections.CommSiteTest.ConnectionString
    4.         HttpContext.Current.Session("DeptID") = CType(CountyDepartments.GetDepartmentsByName(CType(sender, LinkButton).Text)(0).Field("ID").ToString, Integer)
    5.         AjaxControlToolkit.ToolkitScriptManager.RegisterClientScriptBlock(Me.Page, Me.Page.GetType(), "Reroute", "window.redirect('AgendaBuildItemManagement.aspx')", True)
    6.     End Sub

    Every example I've seen has the Onclick="..." set in the markup, is that required? Is there a way to do what I'm trying to do? Or is there a way to get around the querystring problem with the AjaxFileUploader?

    Thanks,

    Justin

    **Edit:

    I know I have Lin.PostBackURL and Lin.setAttribute(...). It didn't work with just setAttribute and I saw a post online about someone setting the PostBackURL and it working... But no luck for me...
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2008
    Location
    Texas
    Posts
    1,288

    Re: OnClick Help.

    Would I need to do .SetAttribute("runat","server")? That way the control's event will be triggered server side and not client side?
    You down with OOP? Yeah you know me!
    MCAD and MCMICKEYMOUSE (vb.net)

    ----

    If it even kinda helps... rate it : )

    Edit a Multi-page .tif file and save.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width