<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: ASP.Net Dynamic Controls (Part 4)</title>
	<atom:link href="http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/feed/" rel="self" type="application/rss+xml" />
	<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/</link>
	<description>Discussion on Development in Several Different Flavours</description>
	<pubDate>Sun, 12 Oct 2008 00:17:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Daniel D' Aarmas</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-36447</link>
		<dc:creator>Daniel D' Aarmas</dc:creator>
		<pubDate>Thu, 25 Sep 2008 15:39:13 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-36447</guid>
		<description>Hi, I've been reading your posts and are great but  I have a question to help me in my development. I'm trying to add panels dynamically with out clear the previous. I mean initially I have just 1 panel with some textboxes, in the bottom of the page I have a Button to "Add a new panel", ok i just want to click that button and render in my page a new panel without deleting de previous one, and if i have added 3 panels when i click the fourth time the button get the 4 panels rendered in the page. This can be done?? Thanks for your support!!!!</description>
		<content:encoded><![CDATA[<p>Hi, I&#8217;ve been reading your posts and are great but  I have a question to help me in my development. I&#8217;m trying to add panels dynamically with out clear the previous. I mean initially I have just 1 panel with some textboxes, in the bottom of the page I have a Button to &#8220;Add a new panel&#8221;, ok i just want to click that button and render in my page a new panel without deleting de previous one, and if i have added 3 panels when i click the fourth time the button get the 4 panels rendered in the page. This can be done?? Thanks for your support!!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeevan</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-35338</link>
		<dc:creator>Jeevan</dc:creator>
		<pubDate>Tue, 16 Sep 2008 10:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-35338</guid>
		<description>Hai.
Is there any posibility to generate complete grid view in dynamic means withour html source. using only code behind. if yes..
add drop downlist and checkbox from coding</description>
		<content:encoded><![CDATA[<p>Hai.<br />
Is there any posibility to generate complete grid view in dynamic means withour html source. using only code behind. if yes..<br />
add drop downlist and checkbox from coding</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ming</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-33365</link>
		<dc:creator>Ming</dc:creator>
		<pubDate>Sun, 24 Aug 2008 20:37:08 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-33365</guid>
		<description>Great Hints,
I have using one day to think about how to prevent  dynamic control disappear after post back and maintenance the viewstate.
It seem i just leave it re-generate every times on Page_Load and keep the same ControlID is the easy way to solve my problem.</description>
		<content:encoded><![CDATA[<p>Great Hints,<br />
I have using one day to think about how to prevent  dynamic control disappear after post back and maintenance the viewstate.<br />
It seem i just leave it re-generate every times on Page_Load and keep the same ControlID is the easy way to solve my problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BigT</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-20775</link>
		<dc:creator>BigT</dc:creator>
		<pubDate>Wed, 06 Feb 2008 21:22:40 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-20775</guid>
		<description>Extremely Helpful Adam!!!!
Thank you SIR! Saved me many hours of headaches...</description>
		<content:encoded><![CDATA[<p>Extremely Helpful Adam!!!!<br />
Thank you SIR! Saved me many hours of headaches&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-20747</link>
		<dc:creator>Dave</dc:creator>
		<pubDate>Tue, 05 Feb 2008 20:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-20747</guid>
		<description>Here is an example of pulling from the database and processing the ids in the save click.

&lt;pre&gt;&lt;code&gt;&#60;%@ Page Language="VB" %&#62;
&#60;%@ Import Namespace="System.Data.SqlClient" %&#62;

&#60;script runat="server"&#62;

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   Dim chk As CheckBox
   Dim sdr As SqlDataReader, cmd As SqlCommand, dbConn As SqlConnection

   dbConn = New SqlConnection("Data Source=localhost;Initial Catalog=Northwind")
   dbConn.Open()
   cmd = New SqlCommand("SELECT SupplierID, CompanyName FROM Suppliers ORDER BY CompanyName", dbConn)
   sdr = cmd.ExecuteReader()
   While (sdr.Read())
     chk = New CheckBox()
     chk.ID = "chk" &#38; sdr("SupplierID")
     chk.Text = sdr("CompanyName")
     phControls.Controls.Add(chk)
     phControls.Controls.Add(New LiteralControl("&#60;br /&#62;"))
   End While
   sdr.Close()
 End Sub

 Sub Click_Save(ByVal s As Object, ByVal e As EventArgs)
   lblMessage.Text = "Saving: "
   Dim id As String
   For Each ctl As Control In phControls.Controls
     If Left(ctl.ID, 3) = "chk" AndAlso (CType(ctl, CheckBox)).Checked Then
       id = Mid(ctl.ID, 4)
       '------------------ Process checked id's here ----------------------------
       lblMessage.Text += id &#38; " "
     End If
   Next
 End Sub

&#60;/script&#62;

&#60;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&#62;
&#60;html xmlns="http://www.w3.org/1999/xhtml" &#62;
  &#60;head runat="server"&#62;
    &#60;title&#62;Dynamic Checkoxes&#60;/title&#62;
  &#60;/head&#62;
  &#60;body&#62;
  &#60;form id="form1" runat="server"&#62;
    &#60;div&#62;
    &#60;asp:Label ID="lblMessage" runat="server" /&#62;
    &#60;br /&#62;&#160;&#60;br /&#62;
    &#60;asp:PlaceHolder ID="phControls" runat="server" /&#62;
    &#60;br /&#62;&#160;&#60;br /&#62;
    &#60;asp:Button ID="btnSave" OnClick="Click_Save" Text="Save Checkboxes" runat="server" /&#62;
    &#60;/div&#62;
  &#60;/form&#62;
  &#60;/body&#62;
&#60;/html&#62;&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Here is an example of pulling from the database and processing the ids in the save click.</p>
<pre><code>&lt;%@ Page Language="VB" %&gt;
&lt;%@ Import Namespace="System.Data.SqlClient" %&gt;

&lt;script runat="server"&gt;

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
   Dim chk As CheckBox
   Dim sdr As SqlDataReader, cmd As SqlCommand, dbConn As SqlConnection

   dbConn = New SqlConnection("Data Source=localhost;Initial Catalog=Northwind")
   dbConn.Open()
   cmd = New SqlCommand("SELECT SupplierID, CompanyName FROM Suppliers ORDER BY CompanyName", dbConn)
   sdr = cmd.ExecuteReader()
   While (sdr.Read())
     chk = New CheckBox()
     chk.ID = "chk" &amp; sdr("SupplierID")
     chk.Text = sdr("CompanyName")
     phControls.Controls.Add(chk)
     phControls.Controls.Add(New LiteralControl("&lt;br /&gt;"))
   End While
   sdr.Close()
 End Sub

 Sub Click_Save(ByVal s As Object, ByVal e As EventArgs)
   lblMessage.Text = "Saving: "
   Dim id As String
   For Each ctl As Control In phControls.Controls
     If Left(ctl.ID, 3) = "chk" AndAlso (CType(ctl, CheckBox)).Checked Then
       id = Mid(ctl.ID, 4)
       '------------------ Process checked id's here ----------------------------
       lblMessage.Text += id &amp; " "
     End If
   Next
 End Sub

&lt;/script&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt;
  &lt;head runat="server"&gt;
    &lt;title&gt;Dynamic Checkoxes&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
    &lt;div&gt;
    &lt;asp:Label ID="lblMessage" runat="server" /&gt;
    &lt;br /&gt;&nbsp;&lt;br /&gt;
    &lt;asp:PlaceHolder ID="phControls" runat="server" /&gt;
    &lt;br /&gt;&nbsp;&lt;br /&gt;
    &lt;asp:Button ID="btnSave" OnClick="Click_Save" Text="Save Checkboxes" runat="server" /&gt;
    &lt;/div&gt;
  &lt;/form&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: sue</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-19220</link>
		<dc:creator>sue</dc:creator>
		<pubDate>Sat, 05 Jan 2008 17:02:34 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-19220</guid>
		<description>Thanks so much for posting this; it helped me quickly solve an issue I've been struggling with! ~ Sue</description>
		<content:encoded><![CDATA[<p>Thanks so much for posting this; it helped me quickly solve an issue I&#8217;ve been struggling with! ~ Sue</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14537</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Sat, 18 Aug 2007 05:01:20 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14537</guid>
		<description>C# Equivalent:

&lt;pre&gt;&lt;code&gt;cmd.Click += new EventHandler(Button_Click);&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>C# Equivalent:</p>
<pre><code>cmd.Click += new EventHandler(Button_Click);</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: sachin jain</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14527</link>
		<dc:creator>sachin jain</dc:creator>
		<pubDate>Fri, 17 Aug 2007 12:28:14 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14527</guid>
		<description>Kindly tel me how to add this handler in c#(c# code)

AddHandler cmd.Click, AddressOf Button_Click</description>
		<content:encoded><![CDATA[<p>Kindly tel me how to add this handler in c#(c# code)</p>
<p>AddHandler cmd.Click, AddressOf Button_Click</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan Voir</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14430</link>
		<dc:creator>Alan Voir</dc:creator>
		<pubDate>Mon, 13 Aug 2007 04:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-14430</guid>
		<description>I thought Part 4 was supposed to be about AJAX?  Looks like that one got ya stumped, eh? ;-)

Just as an FYI, as a writer, you really ought to refactor this series of articles.  Most programmers are interested in the right way to do something, and  why it's right.  You have whole articles (Part 1 and Part 2?) that essentially tell people the wrong way to do things...so why would you want someone to read that?</description>
		<content:encoded><![CDATA[<p>I thought Part 4 was supposed to be about AJAX?  Looks like that one got ya stumped, eh? ;-)</p>
<p>Just as an FYI, as a writer, you really ought to refactor this series of articles.  Most programmers are interested in the right way to do something, and  why it&#8217;s right.  You have whole articles (Part 1 and Part 2?) that essentially tell people the wrong way to do things&#8230;so why would you want someone to read that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: HLL</title>
		<link>http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-7324</link>
		<dc:creator>HLL</dc:creator>
		<pubDate>Mon, 07 May 2007 07:31:00 +0000</pubDate>
		<guid isPermaLink="false">http://devsushi.com/2007/01/19/aspnet-dynamic-controls-part-4/#comment-7324</guid>
		<description>Hi, I read your blog. And it is really helpful. But I dont wantto create controls in a for loop in my Page_Load. 
I have a case like; User selects "DataGrid" or "TextBox" or "CheckBox" from a dropdownlist and presses to a button. Every button click i need to add a textbox or a checkbox (what user selects.) to my placeholder. I could not find a solution to this. 
The only solution that i found is: to add all current controls (and their values) to session after adding to placeholder. And in every page load to get controls from Session and add to page one by one..
Is there any other way? I dont want to do like that.</description>
		<content:encoded><![CDATA[<p>Hi, I read your blog. And it is really helpful. But I dont wantto create controls in a for loop in my Page_Load.<br />
I have a case like; User selects &#8220;DataGrid&#8221; or &#8220;TextBox&#8221; or &#8220;CheckBox&#8221; from a dropdownlist and presses to a button. Every button click i need to add a textbox or a checkbox (what user selects.) to my placeholder. I could not find a solution to this.<br />
The only solution that i found is: to add all current controls (and their values) to session after adding to placeholder. And in every page load to get controls from Session and add to page one by one..<br />
Is there any other way? I dont want to do like that.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
