Dealing with manually created control in ASP.net/VB.net

I am manually creating buttons on my web page in my code behind load event. The buttons are to be tied with some manually created textboxes.

I want the textboxes to be invisible unless the user clicks the button associated with the textbox.

1. Not sure how to call the click events of the buttons. There are many buttons. I guess a generic click handler evaluating the ID if the button.

2.How to set the textbox visible when I do not know the full name of the control since they are dynamically created.

Any help is appreciated.

Tyler
tybartonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tybartonAuthor Commented:
Ok I think I found a solution for the first part. Sorta....maybe.
The buttons have a onclientclick so I created a function for the click and point the onclientclick to that function.

dim lnkbtn as new linkbutton
lnkbtn.id = "Test"
lnkbtn.onclientclick = buttonclickevent(lnkbtn.id)

Protected Function ButtonClickEvent(byval strid as string) as boolean

End Function

It sorta works. When I render the page and click on the button I first get a error in the dynamic page. It looks like when I use this event ASP.net adds a OnClick = "false" to the button. If I hit continue the function does run however I'm worried that the page will choke in production.

Still not sure about number 2.

Thanks,

Tyler
0
CodeCruiserCommented:
0
tybartonAuthor Commented:
Actually I beleive they would because the are actually rendered on the page just not visible. The issue is this page is a massive table with lots of cells and controls 98% completed and all manually created in the code behind due to a large number of sql queries that need to be ran to get data for the controls. So a redesign is not in my future.

Thanks,

Ty
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

CodeCruiserCommented:
>Actually I beleive they would because the are actually rendered on the page just not visible.

Have you checked the html in the browser? Can you show screenshot of the page?
0
tybartonAuthor Commented:
I stand corrected. They are not there which is odd cause I could swear that I did this before. I'll have to look for the code. Maybe I kept the controls visible in the code behind then changed the visibility in jscript not sure.

Thanks,

Ty
0
CodeCruiserCommented:
If you want them to be rendered but not visible, set the Style attribute to "Display:None"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tybartonAuthor Commented:
I'll have to try that on Monday when I get to work.

Thanks,
Ty
0
tybartonAuthor Commented:
That worked great. I also figured out how to deal with the dynamic buttons. I am going to give you half credit for your part of the answer.

Thanks,

Tyler
0
tybartonAuthor Commented:
Half of the questions was answered. I figured out the rest.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.