Dynamic Controls

There are 12 entries for the tag Dynamic Controls

Dynamically Adding TextBox Control to ASPNET Table: Part 2

Few months ago I wrote an example about Dynamically Adding TextBox Control to ASPNET Table. As a recap that example demonstrate how to generate rows of TextBoxes in a Table control based on the number of rows and number of columns provided and as well as print the values entered by the user using the Request.Forms collections.. Recently,one of the user is asking if how are we going to accomplish the same thing by generating the TextBox in the Table based on the data from the database. So in this...

Master Page: Dynamically Adding Rows in ASP Table on Button Click event

In my previous post here, I wrote an example that demonstrates how are we going to generate table rows dynamically using ASP Table on click of the Button control. Now based on some comments in my previous example and in the forums they wanted to implement it within Masterpage. Unfortunately the code in my previous example doesn't work in Masterpage for the following main reasons: The Table is dynamically added within the Form tag and so the TextBox control will not be generated correcty in the page....

Building Dynamic Repeater Rows

Few months ago I wrote a series of blog posts about creating a dynamic rows in GridView and Table. In this example I'm going to demonstrate how to build a simple form that allows you to create a dynamic row using the standard ASP Repeater control. To get started, let’s grab a Repeater control from the Visual Studio Toolbox and place it in the WebForm. The mark up should look something like this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml...

Adding Dynamic Rows in GridView with TextBox and DropDownList - Validation

In my previous post here I have demonstrated how to add dynamic rows in Gridview with a combination of TextBox and DropDownList. Just in case you need to validate empty TextBox values before adding a new row to the GridView then here's a JavaScript function that you can use for validation: function ValidateEmptyValue() { var gv = document.getElementById("&l... Gridview1.ClientID %>"); var tb = gv.getElementsByTagName("in... for (var i = 0; i < tb.length; i++) { if (tb[i].type == "text")...

Adding Dynamic Rows in GridView with TextBox and DropDownList

Few months ago I wrote a sample demo on how to Add Dynamic Rows in GridView with TextBoxes and how to Add Dynamic Rows in GridView with DropDownLists. I have had a few comments and emails asking how to do the same with a combination of TextBox and DropDownList. In this post, I'm going to show you the way on how to this. Here are the code blocks below: ASPX: <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"... <Columns> <asp:BoundField DataField="RowNumber"...

FAQ: How to- Generate Dynamic TexBox in the Form and Save the values to Database

Few months ago I've been seeing many users in the forum asking how to generate dynamic textbox on the form and save the values to the database on Button click, so I've decided to write this post and wrap up all the examples that I wrote before on how to accomplish the task using different controls so that when I encounter such or similar questions again in the forum, I can simply refer them to this post. Here are those examples: Using ASP Table: FAQ: Dynamically Adding Rows in ASP Table on Button...

Adding Dynamic Editable Rows in ASP Table with Multiple Delete

In my previous example, I wrote a simple demo on how to generate rows of TextBoxes in ASP Table on every click of the Button and retain the previous values on postbacks. In this article, I’m going to extend a bit of what I have shown in my previous example. Basically, I’m going to add multiple delete functionality in the Table by adding some rows of CheckBoxes. Here are the code blocks below: ASPX SOURCE VIEW: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Dynamic...

Adding Dynamic Rows in GridView with DropDownLists

Few days ago, a developer posts a comment in my previous article about “Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes” asking if how to implement the same functionality with DropDownList. In this example, I will going to show on how to generate a Row in GridView with DropDownList when clicking a Button that is residing inside a GridView Footer and retain the Selected Items of the DropDownList on postbacks. Here are the code blocks below: ASPX Source: <html xmlns="http://www.w3.org/19...

FAQ: Dynamically Adding Rows in ASP Table on Button Click event

I decided to write this simple example because I always encounter this kind of issue at the asp.net forums including this thread: http://forums.asp.net/t/144... Basically this demo shows on how to generate rows of TextBoxes in ASP Table on every click of the Button and retain the entered values on postbacks. Here are the code blocks below: ASPX: <html xmlns="http://www.w3.org/19... <head runat="server"> <title>Dynamic Adding of Rows in ASP Table Demo</title>...

Adding Dynamic Rows in GridView with TextBoxes

Introduction: I decided to write this article because this has been asked so many times before at the forums(http://forums.asp.net) . Basically, this example shows on how to generate a Row in GridView with TextBoxes when clicking a Button that is residing inside the GridView footer. To get started, let’s grab a GridView control from the Visual Studio Toolbox and put it in the WebForm. The mark up would look something like this: <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"...

Links to Read before Working on Dynamic Controls in ASP.NET

I would like to share with you the following useful articles and FAQ's below about Dynamic Controls in ASP.NET: Dynamically Creating controls in ASP.NET http://support.microsoft.co... http://www.singingeels.com/... Truly Understanding Dynamic Controls http://weblogs.asp.net/infi... Key to ensuring dynamic ASP.NET controls save Viewstate - level 300 http://codebetter.com/blogs...

Dynamically Adding TextBox Control to ASPNET Table

This demo shows how to generate a Table with TextBoxes dynamically based from the number of Columns and Rows entered from the TextBox control and print the values of the dynamically added TextBox on the page. See the screen shot below: To start, let’s declare the following global variables below: private int numOfRows = 0; private int numOfColumns = 0; Here’s the code block for the generating the Tables with TextBoxes. private void GenerateTable(int colsCount, int rowsCount){ //Creat the Table and...