Click here to Skip to main content
15,877,573 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi......

I am generating dyanmic link buttons in master page.I am try to access this button javascript.i am writting code in javascript to list out all controls on the form but i am not got the id of this button in javascript.i am assign ClientIdMode to button as static but still not able to find.provide soln for it.
my code is

code behind:
VB
Private Sub genBtn(ByVal btnText As String)

        Dim b As New LinkButton
        
        b.Attributes.Add("OnClick", "setMode('" + btnText + "')")
        b.Text = btnText + " "
        b.ID = "btn" + btnText
        b.Height = 23
        b.BorderStyle = BorderStyle.None
        b.ClientIDMode = UI.ClientIDMode.Static
        b.Font.Bold = True
        b.Font.Name = "comic Sans MS"
        b.Font.Size = "11"
        b.ForeColor = Drawing.Color.White
        'b.Enabled = True
        b.Attributes.Add("style", "cursor:hand")
        modeTd.Controls.Add(b)
        ModeBtnCnt = ModeBtnCnt + 1
        AddHandler b.Click, EnableDisabledMenu()
        If ModeBtnCnt = 1 Then
            hdnModeList.Value = b.ID
        Else
            hdnModeList.Value = hdnModeList.Value + "," + b.ID
        End If
       
    End Sub

javascript code is:
JavaScript
for (var i = 0; i < document.forms(0).elements.length; i++) {
        alert(document.forms(0).elements(i).name);
    }
Posted
Updated 7-Jun-12 20:12pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900