(Forum Q & A Drop) How to operate the dynamic object, pay value payment

xiaoxiao2021-03-06  14

The specific explanation of the problem: Data table 1 Record control name, data table 2 Record control of the record controls How to make pay value for the property of the control, how to call me: Table 1 field OCXID OCXNAME 1 TextBox 2 ComboBox

Table 2 Fields OCXID ProID ProID ProID 1 1 TEXT 1 2 TOP 2 1 Text 2 2 Top, etc.

What I want to achieve is: there is a TextBox1 (dynamically generated) DIM TMPSTR AS STRING TMPSTR = DS.TABLES ("Table 2"). Rows (0) .Items ("provalue") TextBox1.tmpstr = "abcd" implementation The purpose is to do this, but can't write this, I don't know what to do.

Answer: TextBox T = (TextBox) this.FindControl ("textBox1"); PropertyInfo Info = (T.gettype (). GetProperty ("text"); if (info! = Null) {Object val = info.getValue T, NULL); if (val! = null) this.label1.text = val.tostring ();} Don't forget Using System.Reflection; where "TextBox1" is changed to the control name "Text" in your database Change the properties of the controls read in your data

转载请注明原文地址:https://www.9cbs.com/read-48105.html

New Post(0)