|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Retrieving all properties of control how to -asp.nethi,
could please help me to retrieve properties of a control, i got a scenario to read all available properties and its current assigned values for different controls in project. i tried with reflector tool but it giving properties of classes. I am not sure how to get property and its value. right now i have open property window for each control (Properties window) and noting down from a-z properties and its values. could you help me to get programmatically all properties and its value? Given a texbox and a button.
Imports System.Reflection Partial Class _Default Inherits System.Web.UI.Page Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dump(TextBox1) End Sub Private Sub Dump(ByVal o As Object) Dim t As Type = o.GetType For Each mi As MemberInfo In t.GetMembers If mi.MemberType = MemberTypes.Property Then Dim prop As Object = t.InvokeMember(mi.Name, BindingFlags.GetProperty, Nothing, o, Nothing, Nothing) Try Response.Write(mi.Name & "=" & prop.ToString & "<br>") Catch ex As Exception End Try End If Next End Sub End Class Thanks Mike Let me try i have been googling to get a clue
MikeS wrote: Show quoteHide quote > Given a texbox and a button. > > Imports System.Reflection > Partial Class _Default > Inherits System.Web.UI.Page > Protected Sub Button1_Click(ByVal sender As Object, ByVal e As > System.EventArgs) Handles Button1.Click > Dump(TextBox1) > End Sub > Private Sub Dump(ByVal o As Object) > Dim t As Type = o.GetType > For Each mi As MemberInfo In t.GetMembers > If mi.MemberType = MemberTypes.Property Then > Dim prop As Object = t.InvokeMember(mi.Name, > BindingFlags.GetProperty, Nothing, o, Nothing, Nothing) > Try > Response.Write(mi.Name & "=" & prop.ToString & > "<br>") > Catch ex As Exception > End Try > End If > Next > End Sub > End Class
Login control - image button with text over it
how to get selectedvalue of radiobuttonlist in Javascript? List Box : help preventing duplicate items GridView EnableSortingAndPagingCallBacks Select command. Searching for a powerfull calendar addon Accessing USER CONTROL which is inside Masterpage through Another USER Control inside normal page. User Control used in Repeater, but no output Session sharing between ASP and ASP.NET StyleSheetTheme not working Use CSS in themes |
|||||||||||||||||||||||