dynamic-controls

Angular 9 Formarray search operation executing for only first dynamic control

醉酒当歌 提交于 2020-05-17 06:26:09
问题 I have a formarray with certain fields one of which is input. In this field, on user input, we search in the API's and return some data. The problem is, it is working only for first dynamic control. When I add more controls, it is not working for them. I guess this is happening because I have written search logic in ngAfterViewInit() . But what's the alternative then. I can't get how to solve this problem. Thank you In advance .ts purchaseform = this.fb.group({ vendor_mobile : ['',

Adding and removing dynamic controls Windows Forms using C#

给你一囗甜甜゛ 提交于 2020-02-06 05:44:32
问题 I have three Tabs in my Windows Forms form. Depending on the selected RadioButton in the TabPages[0] , I added few dynamic controls on the relevant TabPage. On the Button_Click event the controls are added, but the problem is I'm not able to remove the dynamically added controls from the other (irrelevant) TabPage. Here's my code: Label label235 = new Label(); TextBox tbMax = new TextBox(); label235.Name = "label235"; tbMax.Name = "txtBoxNoiseMax"; label235.Text = "Noise"; tbMax.ReadOnly =

Show each record in each usercontrol's textbox

安稳与你 提交于 2019-12-23 05:22:45
问题 I create a usercontrol(usercontrol2) and add textBox on the usercontrol(usercontrol2). Form Code: using (SqlConnection myDatabaseConnection = new SqlConnection(myConnectionString.ConnectionString)) { myDatabaseConnection.Open(); using (SqlCommand SqlCommand = new SqlCommand("Select LastName from Employee", myDatabaseConnection)) using (SqlDataAdapter da = new SqlDataAdapter(SqlCommand)) { SqlDataReader DR1 = SqlCommand.ExecuteReader(); int y = 0; while (DR1.Read()) { y++; for (int i = 0; i <

Insert dynamic controls into middle of controls collection

我们两清 提交于 2019-12-22 06:58:56
问题 this is my very first post! I'm pretty desperate so I'm going above and beyond my standard googling. I believe this is an advanced or expert-level .NET question. The problem is that I have built a .NET web application that needs to be able to insert user controls dynamically into the middle of a list. I'm quite comfortable with dynamic controls so long they only need to be added to the end of the list (ie: I'm familiar with articles like this: http://msdn.microsoft.com/en-us/library/ms972976

Can't Find Controls in GridView on Dynamic Controls

拜拜、爱过 提交于 2019-12-20 05:54:29
问题 I have a gridview where I add textboxes to everycell on runtime. However, I can't seem to access those controls using findcontrol Here is how I add the textboxes to the gridview: If e.Row.RowType = DataControlRowType.DataRow Then For i = 1 To e.Row.Cells.Count - 1 Dim txtSchedule As New TextBox() txtSchedule.ID = "txtSchedule" & i.ToString e.Row.Cells(i).Controls.Add(txtSchedule) Next End If When I go to find the controls it says they are Nothing : GridView1.Rows(0).Cells(cellindex)

Can't Find Controls in GridView on Dynamic Controls

非 Y 不嫁゛ 提交于 2019-12-20 05:54:24
问题 I have a gridview where I add textboxes to everycell on runtime. However, I can't seem to access those controls using findcontrol Here is how I add the textboxes to the gridview: If e.Row.RowType = DataControlRowType.DataRow Then For i = 1 To e.Row.Cells.Count - 1 Dim txtSchedule As New TextBox() txtSchedule.ID = "txtSchedule" & i.ToString e.Row.Cells(i).Controls.Add(txtSchedule) Next End If When I go to find the controls it says they are Nothing : GridView1.Rows(0).Cells(cellindex)

Insert TextBoxes into a Repeater dynamically and retrieve their value

六月ゝ 毕业季﹏ 提交于 2019-12-19 11:46:35
问题 I have a Repeater bound from SQL, containing a mixture of editable and read-only elements. When you click the "Edit" button on a row, the editable portions should convert to textboxes, and when you click "Update", it should save your changes. Here's a (very) simplified version of the Edit and Update buttons' OnClick code: switch(commandName) { case "Edit": Label1.Visible = false; //hide read-only version PlaceHolder1.Visible = true; //show editing version //Dict1 is Dictionary<string, string>

Pre-init function not finding all dynamic controls

大兔子大兔子 提交于 2019-12-19 11:44:11
问题 My scenario : I have 3 radio button. when clicked each one of them show different set of textboxes and a button are created dynamically. My Problem is when i clicked on the button i lose all the dynamically created controls. i eventually found out to initialize the dynamic control on Page_Preinit as below. protected void Page_PreInit(object sender, EventArgs e) { List<string> keys = Request.Form.AllKeys.Where(key => key.Contains("txtDynamic")).ToList(); int i = 1; foreach (string key in keys)

ASP.net Dynamically adding controls on Button press. Postback issue

柔情痞子 提交于 2019-12-19 11:25:43
问题 I have a user control which contains several buttons, depending on the button pressed a different control is added to the page (lets say button 1 adds a TextBox, button2 adds a label). I have code along the lines of: protected void but1_click(object sender, EventArgs e) { TextBox tb = new TextBox(); tb.ID = "tb1"; paramsCtrlDiv.Controls.Add(tb); } protected void but2_click(object sender, EventArgs e) { Label lb = new Label(); lb.ID = "lb1"; paramsCtrlDiv.Controls.Add(lb); } I then have a

Dynamically created controls causing Null reference

让人想犯罪 __ 提交于 2019-12-19 04:59:16
问题 I am trying to dynamically create controls and give them properties during run time. I have put my code inside the Page_Init event, when I run my website I can see my controls but when I click on the submit button an error occurrs saying "Object reference not set to an instance of an object". Here is the code I have used: //Creates instances of the Control Label FeedbackLabel = new Label(); TextBox InputTextBox = new TextBox(); Button SubmitButton = new Button(); // Assign the control