How to cutomise a Usercontrol Solved [modified]
-
Hello All i've a usercontrol with alot of items i want to customize it for each individual page ,for instance making some textboxes,buttons invisible in a particular page , how to? thanks
modified on Sunday, November 8, 2009 1:39 AM
What is the problem. Expose some properties from the usercontrol to set it from any page. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
What is the problem. Expose some properties from the usercontrol to set it from any page. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascriptcheck the properties of the user control you are using. Also u can add controls to it like text box etc , if it supports them and then set the properties as per you requirment. If the user control doesn't support then change to a custom aspx control as per your requirments.
-
What is the problem. Expose some properties from the usercontrol to set it from any page. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptThank you sir , but i was thinking of having a sub that handles all the control intead of exposing each individual item , i vame up with this sub , and it works just fine Public Sub _DisableCont(ByVal Cont_Str As String) Dim _Control As Control For Each _Control In Me.Controls Dim _ControlToString As String = _Control.ToString If _ControlToString = Cont_Str Then _Control.Visible = False End If Next End Sub :)
-
Thank you sir , but i was thinking of having a sub that handles all the control intead of exposing each individual item , i vame up with this sub , and it works just fine Public Sub _DisableCont(ByVal Cont_Str As String) Dim _Control As Control For Each _Control In Me.Controls Dim _ControlToString As String = _Control.ToString If _ControlToString = Cont_Str Then _Control.Visible = False End If Next End Sub :)
Just see you have already did yourself. Our main motive is to help you to solve your own problem yourself. Just to add to your solution, if you need any particular control to do something else check using this :
If TypeOf(_Control) is TextBox Then
Dim tb as TextBox = DirectCast(_Control, TextBox)
tb.ReadOnly = True
End IfYou might also take Select Case in account for this scenario. Cheers. :rose:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript