Click here to Skip to main content
15,892,537 members
Home / Discussions / C#
   

C#

 
QuestionRevit macro with if/else command Pin
William Wydock9-Dec-14 11:15
William Wydock9-Dec-14 11:15 
AnswerRe: Revit macro with if/else command Pin
BillWoodruff9-Dec-14 14:21
professionalBillWoodruff9-Dec-14 14:21 
AnswerRe: Revit macro with if/else command Pin
Eddy Vluggen10-Dec-14 0:32
professionalEddy Vluggen10-Dec-14 0:32 
Questionplease help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gajanangan9-Dec-14 7:22
gajanangan9-Dec-14 7:22 
SuggestionRe: please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gaurigan9-Dec-14 16:17
gaurigan9-Dec-14 16:17 
QuestionRe: please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
Richard MacCutchan9-Dec-14 22:15
mveRichard MacCutchan9-Dec-14 22:15 
AnswerSolved :please help me solve a nested dictionary structure problem!!! (here is a sample code where am i doing wrong) Pin
gaurigan10-Dec-14 13:56
gaurigan10-Dec-14 13:56 
Questionproblem finding control and getting its values for dynamically created textboxes Pin
Dhyanga9-Dec-14 5:34
Dhyanga9-Dec-14 5:34 
Hi,

I have a situation where I need to show data from database to textboxes. These textboxes has to be dynamically created and can be editable. I am able to create textboxes as follows:
C#
string[] myData = liD1.ToArray(); //liD1 is a list that has values from database
public void showData()
{
	for (int i = 0; i < myData.Length; i++)
	{
		if (txtMore.FindControl("txtD1StartTime" + i) == null)
		{
			txtStart1 = new TextBox();
									 
			lblStart1 = new Label();
								   
			txtStart1.ID = "txtD1S" + i;
									 
			lblStart1.ID = "lblD1S" + i;
									  
			txtStart1.Text = myData[i].ToString();
										
			lblStart1.AssociatedControlID = txtStart1.ID;
			
			lblStart1.Text = "Data" + i;
								 
			txtMore.Controls.Add(lblStart1);
			
			txtMore.Controls.Add(txtStart1);
						  
		}
	}
}

In my ascx page, I am loading those textboxes in

as follows:
C#
<ul class="txtMore" id="txtMore"  runat="server">
                                          
 </ul>

showData() function is loading data with dynamically created textboxes. This is working fine. Now If i edit textboxes and try to get new data, it is not giving me anything. Actually it couldn't even find that control. Code is as shown below:

C#
public void getData()
{
	for (int i = 0; i < myData.Length; i++)
	{
		TextBox t = txtMore.FindControl("txtD1S" + i) as TextBox;
		
		if (t != null)
		{
			string temp = t.Text;
        }
	}
}


Even though I have dynamically loaded textboxes from showData(), in getData(),it is not able to find any control. Please help.
Dhyanga

SuggestionRe: problem finding control and getting its values for dynamically created textboxes Pin
Richard Deeming9-Dec-14 6:34
mveRichard Deeming9-Dec-14 6:34 
Questiontrouble to allocate/read buffer modified by native function Pin
Member 111038219-Dec-14 0:20
Member 111038219-Dec-14 0:20 
AnswerRe: trouble to allocate/read buffer modified by native function Pin
Richard MacCutchan9-Dec-14 6:08
mveRichard MacCutchan9-Dec-14 6:08 
QuestionTime out Expires while generating report. Pin
Pushpak Shah8-Dec-14 20:44
professionalPushpak Shah8-Dec-14 20:44 
QuestionRemote powershell / WinRM to Server 2012 Pin
JD868-Dec-14 18:49
JD868-Dec-14 18:49 
SuggestionRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan8-Dec-14 22:07
mveRichard MacCutchan8-Dec-14 22:07 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD869-Dec-14 3:19
JD869-Dec-14 3:19 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
Richard MacCutchan9-Dec-14 5:49
mveRichard MacCutchan9-Dec-14 5:49 
GeneralRe: Remote powershell / WinRM to Server 2012 Pin
JD8610-Dec-14 5:09
JD8610-Dec-14 5:09 
QuestionCreate a nested TreeView for Windows 8.1 app Pin
Bhola S. Parit8-Dec-14 18:20
Bhola S. Parit8-Dec-14 18:20 
AnswerRe: Create a nested TreeView for Windows 8.1 app Pin
BillWoodruff8-Dec-14 21:26
professionalBillWoodruff8-Dec-14 21:26 
Questionrtl gridview Pin
alireza.zahani8-Dec-14 3:36
alireza.zahani8-Dec-14 3:36 
AnswerRe: rtl gridview Pin
alireza.zahani8-Dec-14 3:46
alireza.zahani8-Dec-14 3:46 
GeneralRe: rtl gridview Pin
Blue_Boy8-Dec-14 5:26
Blue_Boy8-Dec-14 5:26 
AnswerRe: rtl gridview Pin
Eddy Vluggen8-Dec-14 8:05
professionalEddy Vluggen8-Dec-14 8:05 
Questionconvert NTP to UTC datetime Pin
Jassim Rahma8-Dec-14 1:31
Jassim Rahma8-Dec-14 1:31 
AnswerRe: convert NTP to UTC datetime Pin
Richard MacCutchan8-Dec-14 1:33
mveRichard MacCutchan8-Dec-14 1:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.