RSS
 

Dynamically adding controls to a placeholder control in ASP.NET

06 Oct

Loop through your collection of controls (count of i) you would like to add to the ASP.NET placeholder control on your aspx page.

Dim lnkButtonSelfInitiate As LinkButton = New LinkButton()
lnkButtonSelfInitiate.Text = vCellLocalLink.InnerText
AddHandler lnkButtonSelfInitiate.Click, AddressOf btn_Click
Me.plhSelfInitiate.Controls.Add(lnkButtonSelfInitiate)
Protected Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.lblTest.Text = “test”
End Sub
 
 

Launch a new window in ASP.NET on a button click using Javascript

06 Oct

The code is pretty simple, but it’s nice to have this snippet around when you need it.

Dim ReportURL as string = “http://www.figers.com”

Dim js As String = ”<script language=”"javascript”" type=”"text/javascript”"> window.open(‘” & ReportURL & “‘);</script>”

Page.ClientScript.RegisterClientScriptBlock(Me.GetType, “NewWindow”, js)

 
 

Why visit

14 Jun

I plan on sharing what I’ve come across while travelling the world (Buenos Aires & Antarctica this December, here we come),  freelancing as a software engineer under my own company (www.figers.com) and managing our rental real estate in Boston. Yeah, this is gonna be an interesting year…