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...