How to access a dynamic web controls?

Results 1 to 2 of 2

Thread: How to access a dynamic web controls?

  1. #1
    Join Date
    Dec 1969

    Default How to access a dynamic web controls?

    I have some dynamic table and dynamic ImageButton <BR>Example : <BR>There are 4 table, each ID is "Tbl1", "Tbl2", "Tbl3", and "Tbl4" <BR>There are 4 Image button, each ID is "Img1", "Img2", "Img3", and "Img4". <BR>I want to put "onclick" subroutine to Image button. The subroutine is to make the Table&#039;s visible = false. So if I clicked "Img1", then "Tbl1" visible will be false. <BR>Can anyone tell me how to do this? <BR><BR>Script : <BR>For i = 1 to 4 <BR> Img = New ImageButton() <BR> Img.ImageUrl = "Images/Icon.gif" <BR> Img.ID = "Img" & i <BR> AddHandler Img.Click, AddressOf VisibleSub <BR> Tbl = New Table() <BR> Tbl.ID = "Tbl" & i <BR>Next <BR>Sub VisibleSub(Sender as Object,E as ImageClickEventArgs) <BR> Dim ID = Right(Sender.ID,1)<BR> &#039;###I GET THE ID, BUT I WANT TO MAKE ("TBL"&ID.VISIBLE=FALSE)<BR> &#039;###BUT IT&#039;S NOT POSSIBLE<BR> &#039;####WHAT SYNTAX DO I HAVE TO WRITE?? <BR> &#039;####THANK&#039;S FOR YOUR HELP <BR>End Sub

  2. #2
    Join Date
    Dec 1969

    Default RE: use e.findcontrol

    This will probably solve your problem.<BR><BR>********************<BR>Sub VisibleSub(Sender as Objec, E as ImageClickEventArgs)<BR>Dim Table1 as Table<BR> <BR>Table1 = E.Item.FindControl("Tbl1")<BR>Table1.visible = false<BR>End Sub<BR>********************

Posting Permissions

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