<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>How To Do Everything &#124; How To Tutorials &#187; ASP.NET</title>
	<atom:link href="http://howtoideas.net/category/computer-and-programming/programming-languages/asp-net/feed" rel="self" type="application/rss+xml" />
	<link>http://howtoideas.net</link>
	<description>How To Ideas</description>
	<lastBuildDate>Wed, 25 Apr 2012 21:22:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How To Get User&#8217;s IP Address In ASP.NET</title>
		<link>http://howtoideas.net/how-to-get-users-ip-address-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-get-users-ip-address-in-asp-net#comments</comments>
		<pubDate>Sat, 25 Jun 2011 10:48:30 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[client IP address]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[user IP address]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-get-users-ip-address-in-asp-net</guid>
		<description><![CDATA[Some times for security purposes, when any user login to your site, you want to save his IP Address in your database or somewhere else. You might even want to print the IP Address of the user to warn them not to do anything wrong on your website. In this article, I will show you two different ways or two different statements to get user’s IP address. Instructions:&#160; Using UserHostAddress... <span class="meta-more"><a href="http://howtoideas.net/how-to-get-users-ip-address-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Some times for security purposes, when any user login to your site, you want to save his IP Address in your database or somewhere else. You might even want to print the IP Address of the user to warn them not to do anything wrong on your website. In this article, I will show you two different ways or two different statements to get user’s IP address.</p>
<p><strong>Instructions:</strong>&#160;</p>
<ol>
<li>Using <em>UserHostAddress </em>property&#160; <br /><em><code>Request.UserHostAddress</code></em>&#160;&#160; gives you the IP address of client visiting your website. </li>
<li>Using <em>ServerVariables        <br /><code>Request.ServerVariables[&quot;REMOTE_ADDR&quot;]</code>&#160;&#160; </em>gives you the IP address of client’s machine as well. Use any of these two methods to get Client’s IP Address.       </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-get-users-ip-address-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Disable Session State Creation In ASP.NET</title>
		<link>http://howtoideas.net/how-to-disable-session-state-creation-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-disable-session-state-creation-in-asp-net#comments</comments>
		<pubDate>Mon, 06 Jun 2011 18:39:56 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[c sharp]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[disable session]]></category>
		<category><![CDATA[disable session state]]></category>
		<category><![CDATA[enable session for particular page]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-disable-session-state-creation-in-asp-net</guid>
		<description><![CDATA[As ASP.NET Session State is on by default in ASP.NET, and if you are not using Sessions in your website, you should prefer to disable it, because it will save your server load and will also help you in optimizing your website. Instructions: If you are sure, you don’t want to use session on any of your website page, then turn off sessions completely by adding following lines of code... <span class="meta-more"><a href="http://howtoideas.net/how-to-disable-session-state-creation-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>As ASP.NET Session State is on by default in ASP.NET, and if you are not using Sessions in your website, you should prefer to disable it, because it will save your server load and will also help you in optimizing your website.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>If you are sure, you don’t want to use session on any of your website page, then turn off sessions completely by adding following lines of code in your <em>Web.Config</em> file under <em>&lt;System.Web&gt;</em> section.       <br /> <br />
<blockquote><code>&lt;sessionState mode=&quot;Off&quot;&gt;&lt;/sessionState&gt;</code></p></blockquote>
<p><a href="http://howtoideas.net/wp-content/uploads/2011/06/image4.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Disable Session State ASP.NET" border="0" alt="Disable Session State ASP.NET" src="http://howtoideas.net/wp-content/uploads/2011/06/image_thumb4.png" width="504" height="194" /></a> </li>
<li>If you want to use session state on some pages, not the entire website, then you can disable session state for your entire website and then you can enable it for those particular pages. Use then following line of code to disable session state for all of the pages.      <br /> <br />
<blockquote><code>&lt;pages enableSessionState=&quot;false&quot;&gt;</code></p></blockquote>
<p><a href="http://howtoideas.net/wp-content/uploads/2011/06/image5.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Disable Session State For All The Pages" border="0" alt="Disable Session State For All The Pages" src="http://howtoideas.net/wp-content/uploads/2011/06/image_thumb5.png" width="504" height="64" /></a>       <br />after this you can enable session state for a particular page by enabling this in the <em>page</em> directive of particular page using the following syntax.       <br /> <br />
<blockquote><code>&lt;%@ Page Language=&quot;C#&quot; EnableSessionState=&quot;True&quot;...</code></p></blockquote>
<p><a href="http://howtoideas.net/wp-content/uploads/2011/06/image6.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Enable Session State In Particular Page" border="0" alt="Enable Session State In Particular Page" src="http://howtoideas.net/wp-content/uploads/2011/06/image_thumb6.png" width="454" height="73" /></a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-disable-session-state-creation-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Store Custom Objects In web.config In ASP.NET</title>
		<link>http://howtoideas.net/how-to-store-custom-objects-in-web-config-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-store-custom-objects-in-web-config-in-asp-net#comments</comments>
		<pubDate>Fri, 27 May 2011 07:24:20 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[change value of custom object]]></category>
		<category><![CDATA[custom object in web.config]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[retrieve value of custom object from web.config]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[web.config]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-store-custom-objects-in-web-config-in-asp-net</guid>
		<description><![CDATA[In this Article, I am going to discuss about how can we store custom objects i.e our own variables in web.config. Generally we used to have some data in appSettings section of web.config and read it when required in web forms. But actually we can not only read that data i code behind files for our web forms but we can update the data as well in web.config programmatically. There... <span class="meta-more"><a href="http://howtoideas.net/how-to-store-custom-objects-in-web-config-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>In this Article, I am going to discuss about how can we store custom objects i.e our own variables in <code><em>web.config</em></code>. Generally we used to have some data in <code><em>appSettings</em></code> section of <em>web.config</em> and read it when required in web forms. But actually we can not only read that data i code behind files for our web forms but we can update the data as well in<em> web.config</em> programmatically.</p>
<p>There are number of pre defined object which we can create in <em>web.config. But the</em> main point of this article is, storing some object of custom type in web.config. This can be very useful in a number of scenarios.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>First of all we have to create our own custom object in <code><em>appSettings</em></code> section of <em>web.config</em> which we will refer to in our web forms.       <br /> <br />
<blockquote><code>&lt;appSettings&gt;          <br />&#160; &lt;add key=&quot;HowToIdeas&quot; value=&quot;This is a simple message..&quot; /&gt;           <br />&lt;/appSettings&gt;</code></p></blockquote>
</li>
<li>To read its value in code file, add the following namespaces in your code file.      <br /> <br />
<blockquote><code>using System.Configuration;          <br />using System.Web.Configuration;</code></p></blockquote>
</li>
<li>Now use the following line of code to retrieve the value of the object we have created.      <br /> <br />
<blockquote><code>String s = ConfigurationManager.AppSettings[&quot;HowToIdeas&quot;].ToString();          <br />Response.Write(s); </code></p></blockquote>
</li>
<li>Response.Write will write the string on our web page. Here is the output of these statements in my web page.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image59.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Showing Original Message Value" border="0" alt="Showing Original Message Value" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb58.png" width="274" height="104" /></a> </li>
<li>Now to change the value of this object, use the following statement.      <br /> <br />
<blockquote><code>&#160;&#160;&#160; Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);          <br />&#160;&#160;&#160; config.AppSettings.Settings[&quot;HowToIdeas&quot;].Value = &quot;This is the updated message..&quot;;           <br />&#160;&#160;&#160; config.Save(); </code></p></blockquote>
</li>
<li>So when this will run, it will change the value of our object in <em>web.config. </em>But this change will be reflected back the next time when the page will be reloaded. Actually this statement will change the actual value in <em>web.config</em> which will be saved after the page gets fully loaded and this value will be retrieved only after that. </li>
<li>On my page when I click the second button (Original Message) the following output will be shown.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image60.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Showing Original Message Value" border="0" alt="Showing Original Message Value" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb59.png" width="357" height="104" /></a> </li>
<li>After that when I click the 1st button (change value), I get the following output.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image62.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Custom Object Value Is Changed But Still Showing Last Value" border="0" alt="Custom Object Value Is Changed But Still Showing Last Value" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb60.png" width="347" height="104" /></a> </li>
<li>In above screenshot the message shown on page is same as the previous one, but actually the value is changed and will be reflected back the next time. So when I click the third button (New Value), I get the following output.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image63.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Updated Message From Custom Object" border="0" alt="Updated Message From Custom Object" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb61.png" width="333" height="104" /></a> </li>
<li>And when you stop the website, you will also get a message stating your web.config file has been updated from outside.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image64.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Message Showing That web.config File Has Been Changed" border="0" alt="Message Showing That web.config File Has Been Changed" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb62.png" width="504" height="173" /></a> </li>
<li>Here is the snapshot of the whole code I am running on this page.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image65.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Full Code To Access And Change The Value Of Custom Object In web.config" border="0" alt="Full Code To Access And Change The Value Of Custom Object In web.config" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb63.png" width="604" height="284" /></a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-store-custom-objects-in-web-config-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Edit Data In Untyped DataSet In ASP.NET</title>
		<link>http://howtoideas.net/how-to-edit-data-in-untyped-dataset-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-edit-data-in-untyped-dataset-in-asp-net#comments</comments>
		<pubDate>Fri, 13 May 2011 21:15:14 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[Dataset]]></category>
		<category><![CDATA[edit data in dataset]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[repeater]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[Untyped Dataset]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-edit-data-in-untyped-dataset-in-asp-net</guid>
		<description><![CDATA[Dataset is one of those controls which programmers use most of the time for binding data to any of the Data Binding Control. When you fetch data from SQL Server in Dataset, then you can edit the fetched data before binding it to any of the Data Binding control. I have already discussed the same topic for Type Dataset over here. Using this approach your actual data in the Database... <span class="meta-more"><a href="http://howtoideas.net/how-to-edit-data-in-untyped-dataset-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Dataset is one of those controls which programmers use most of the time for binding data to any of the Data Binding Control. When you fetch data from SQL Server in Dataset, then you can edit the fetched data before binding it to any of the Data Binding control. I have already discussed the same topic for Type Dataset <a href="http://howtoideas.net/how-to-use-typed-dataset-in-asp-net" target="_blank">over here</a>. Using this approach your actual data in the Database will not change but the data which will be shown to user in browser.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>Before editing data in DataSet, you need to have data in a <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" target="_blank">DataSet</a> instance. Using following code, I fetched all the data from <em>[abc]</em> Table into DataSet instance <em>ds</em>.       <br /> <br />
<blockquote><code>SqlConnection con = new SqlConnection();          <br />con.ConnectionString = @&quot;Provide your own connection string here&quot;;          <br />SqlCommand cmd = new SqlCommand();           <br />cmd.CommandText = &quot;select * from [abc]&quot;;           <br />cmd.Connection = con;           <br />SqlDataAdapter da = new SqlDataAdapter(cmd);           <br />DataSet ds = new DataSet();           <br />da.Fill(ds);</code></p></blockquote>
<p> and here is the output in browser, If I bind this DataSet to any Data Binding control(Repeater used here)       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image47.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto 6px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Output In Browser Without Editing Data In DataSet" border="0" alt="Output In Browser Without Editing Data In DataSet" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb46.png" width="454" height="222" /></a> </li>
<li>In the above image, I want to change the value for Address column ( <em>[Eadd]</em> – column name or 2 index) in 2nd row ( i.e index 1), then I can do so using any the following code.       <br /> <br />
<blockquote><code>ds.Tables[0].Rows[1][&quot;Eadd&quot;] = &quot;New Value&quot;; //Eadd is the actual column name of Address column in Database</code></p></blockquote>
<p> or       <br /> <br />
<blockquote><code>ds.Tables[0].Rows[1][2] = &quot;New Value&quot;;</code></p></blockquote>
</li>
<li>Here is the output in Browser after using any of the above statement for editing data in DataSet.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image48.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Output In Browser After Editing Data In DataSet" border="0" alt="Output In Browser After Editing Data In DataSet" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb47.png" width="454" height="208" /></a> </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-edit-data-in-untyped-dataset-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Bind Data From SQL Server To Repeater Using SqlDataAdapter And DataSet</title>
		<link>http://howtoideas.net/how-to-bind-data-from-sql-server-to-repeater-using-sqldataadapter-and-dataset</link>
		<comments>http://howtoideas.net/how-to-bind-data-from-sql-server-to-repeater-using-sqldataadapter-and-dataset#comments</comments>
		<pubDate>Fri, 13 May 2011 18:46:19 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[bind data to repeater]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[repeater]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-bind-data-from-sql-server-to-repeater-using-sqldataadapter-and-dataset</guid>
		<description><![CDATA[Some days back, I wrote an article on Binding Data To Repeater Using SqlDataReader class which you can read here. In this article I will explain the easiest way for Binding Data To Repeater Using SqlDataAdapter and DataSet classes. But before explaining this I want to differentiate the two methods (using SqlDataReader or using SqlDataAdapter and DataSet). As SqlDataReader is Forward only, this means, you can read data starting from... <span class="meta-more"><a href="http://howtoideas.net/how-to-bind-data-from-sql-server-to-repeater-using-sqldataadapter-and-dataset">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Some days back, I wrote an article on <strong>Binding Data To Repeater</strong> Using <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx" target="_blank">SqlDataReader</a> class which you can read <a href="http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader">here</a>. In this article I will explain the easiest way for Binding Data To Repeater Using <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.aspx" target="_blank">SqlDataAdapter</a> and <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" target="_blank">DataSet</a> classes. But before explaining this I want to differentiate the two methods (using SqlDataReader or using SqlDataAdapter and DataSet). As SqlDataReader is Forward only, this means, you can read data starting from the very first row of the result to the last row and once you read a row, you can’t read data from that row after that. And also, we can’t modify data in SqlDataReader. So for all those cases, where we just want to fetch data from SQL Server and want to show in any Data Binding control, SqlDataReader will be a better choice. But if we want to modify data before displaying to user in the result from SQL Server, then we have to use SqlDataAdapter and DataSet. because it is not a Forward only, so we can access any row at any time.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>As SqlDataAdapter is a disconnected approach to read data, so we just need to have the connection string of our SQL Server connection, we don’t need to open connection to SQL Server.      <br /> <br />
<blockquote><code>SqlConnection con = new SqlConnection();          <br />con.ConnectionString = @&quot;Provide your own connection string here&quot;; </code></p></blockquote>
</li>
<li>After creating connection to your Database, you will need to build the Query or Command to fetch the data from any Table of that Database using SqlCommand class. Also you have to mention this that on which connection that command will be executed.<br />
<blockquote><code>SqlCommand cmd = new SqlCommand();          <br />cmd.CommandText = &quot;select * from [abc]&quot;;           <br />cmd.Connection = con;</code></p></blockquote>
</li>
<li>Now this command will select all the rows and columns of the Table <em>[abc]</em> present in my Database. Currently I have 3 columns <em>[Eid], [Ename], [Eadd]</em> in this Table. </li>
<li>Now using this command we will store a reference to all the data of the Table in SqlDataAdapter class instance using the following statement.<br />
<blockquote><code>SqlDataAdapter da = new SqlDataAdapter(cmd);</code></p></blockquote>
</li>
<li>Now we have to fill the data in DataSet, so our DataSet instance will fetch all the data and store in itself. So after that, we don’t need an active connection to SQL Server to read data as all the data will be present in DataSet.      <br /> <br />
<blockquote><code>DataSet ds = new DataSet();          <br />da.Fill(ds); </code></code></p></blockquote>
</li>
<li>Now, this DataSet instance <em>ds </em>has the reference to all the records of the Table. So just Bind this instance to our Repeater control to show all the data in that.<br />
<blockquote><code>Repeater1.DataSource = ds;          <br />Repeater1.DataBind();</code></p></blockquote>
</li>
<li>Now we are done with the code, all we have to do now is create template for our Repeater control, so that the data we have bound to that will get shown in the way we want. I have used the same template which I had used in my previous article on Data Binding to Repeater control <a href="http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net">over here</a>.<br />
<blockquote><code>&lt;asp:Repeater ID=&quot;Repeater1&quot; runat=&quot;server&quot;&gt;          <br />&#160;&#160;&#160; &lt;ItemTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;table width=&quot;50%&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;ID:&lt;/b&gt;&lt;%#Eval(&quot;Eid&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Name:&lt;/b&gt;&lt;%#Eval(&quot;Ename&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Address:&lt;/b&gt;&lt;%#Eval(&quot;Eadd&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/table&gt;           <br />&#160;&#160;&#160; &lt;/ItemTemplate&gt;           <br />&#160;&#160;&#160; &lt;SeparatorTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;hr /&gt;&lt;hr /&gt;           <br />&#160;&#160;&#160; &lt;/SeparatorTemplate&gt;           <br />&lt;/asp:Repeater&gt;</code></p></blockquote>
</li>
<li>Here is the output in Browser.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image46.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Output In Browser For Binding Data To Repeater Using SqlDataAdapter And DataSet" border="0" alt="Output In Browser For Binding Data To Repeater Using SqlDataAdapter And DataSet" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb45.png" width="461" height="253" /></a> </code><br />
<blockquote></blockquote>
<p>You can download my sample code as well. <a href="http://howtoideas.net/wp-content/uploads/C%20Sharp%20Source%20Codes/Data%20Binding%20-%20Repeater%20-%20HowToIdeas.rar">Click here To Download</a>.         <br />Note: This method is executed in Default3.aspx page of the sample website which you can download from the link given in above line.</p>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-bind-data-from-sql-server-to-repeater-using-sqldataadapter-and-dataset/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Bind Data From SQL Server Table To Repeater Using SqlDataReader</title>
		<link>http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader</link>
		<comments>http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader#comments</comments>
		<pubDate>Tue, 10 May 2011 09:49:30 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[bind data to repeater]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[repeater]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader</guid>
		<description><![CDATA[Now continuing my discussion on Binding Data to Repeater Control in ASP.NET, today, I will write about how can we Bind Data to Repeater that has been fetched from a SQL Server Table. The process is almost same to the one which I had discussed last time, where I bound a Collection(List) of custom class to Repeater (click here to view last article), the only difference is the way of... <span class="meta-more"><a href="http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Now continuing my discussion on <strong>Binding Data to Repeater Control</strong> in <strong>ASP.NET</strong>, today, I will write about how can we Bind Data to Repeater that has been fetched from a <strong>SQL Server Table</strong>. The process is almost same to the one which I had discussed last time, where I bound a Collection(List) of custom class to Repeater (<a href="http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net" target="_blank">click here to view last article</a>), the only difference is the way of fetching data from the Table, using proper Class to store that data in, and then binding that data to Repeater Control. Here in this article, I will only show you hoe can we use <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx" target="_blank">SqlDataReader</a> class to Bind Data o Repeater control.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>First of all you will need to create and open connection to your Database in SQL Server using Connection String. If you don’t know how to do this, you can view my article on <a href="http://howtoideas.net/how-to-create-sql-connection-in-c" target="_blank">How To Create SQL Connection</a>. </li>
<li>After creating and opening connection to your Database, you will need to build the Query or Command to fetch the data from any Table of that Database using SqlCommand class. Also you have to mention this that on which connection that command will be executed.      <br /> <br />
<blockquote><code>SqlCommand cmd = new SqlCommand();          <br />cmd.CommandText = &quot;select * from [abc]&quot;;           <br />cmd.Connection = con;</code></p></blockquote>
</li>
<li>Now this command will select all the rows and columns of the Table <em>[abc]</em> present in my Database. Currently I have 3 columns <em>[Eid], [Ename], [Eadd]</em> in this Table. </li>
<li>Now using this command we will store a reference to all the data of the Table in SqlDataReader class instance using the following statement.      <br /> <br />
<blockquote><code>SqlDataReader rd = cmd.ExecuteReader();</code></p></blockquote>
</li>
<li>Now, this SqlDataReader instance <em>rd</em> has the reference to all the records of the Table. So just Bind this instance to our Repeater control to show all the data in that.       <br /> <br />
<blockquote><code>Repeater1.DataSource = rd;          <br />Repeater1.DataBind();</code></p></blockquote>
</li>
<li>Now we are done with the code, all we have to do now is create template for our Repeater control, so that the data we have bound to that will get shown in the way we want. I have used the same template which I had used in my previous article on Data Binding to Repeater control <a href="http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net" target="_blank">over here</a>.       <br /> <br />
<blockquote><code>&lt;asp:Repeater ID=&quot;Repeater1&quot; runat=&quot;server&quot;&gt;          <br />&#160;&#160;&#160; &lt;ItemTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;table width=&quot;50%&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;ID:&lt;/b&gt;&lt;%#Eval(&quot;Eid&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Name:&lt;/b&gt;&lt;%#Eval(&quot;Ename&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Address:&lt;/b&gt;&lt;%#Eval(&quot;Eadd&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/table&gt;           <br />&#160;&#160;&#160; &lt;/ItemTemplate&gt;           <br />&#160;&#160;&#160; &lt;SeparatorTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;hr /&gt;&lt;hr /&gt;           <br />&#160;&#160;&#160; &lt;/SeparatorTemplate&gt;           <br />&lt;/asp:Repeater&gt;</code></p></blockquote>
</li>
<li>Here is the output in Browser.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image38.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Output In Browser - data Binding In Repeater " border="0" alt="Output In Browser - data Binding In Repeater " src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb38.png" width="404" height="171" /></a> </li>
</ol>
<p>You can download my sample code as well. <a href="http://howtoideas.net/wp-content/uploads/C Sharp Source Codes/Data Binding - Repeater - HowToIdeas.rar" target="_blank">Click here To Download</a>.    <br />Note: This method is executed in Default2.aspx page of the sample website which you can download from the link given in above line.</p>
<div align="left"><h4>Incoming search terms:</h4></div><ul><li>link repeater to sqldatareader (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-bind-data-from-sql-server-table-to-repeater-using-sqldatareader/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Use Typed Dataset In ASP.NET</title>
		<link>http://howtoideas.net/how-to-use-typed-dataset-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-use-typed-dataset-in-asp-net#comments</comments>
		<pubDate>Sat, 07 May 2011 18:33:42 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[edit typed dataset]]></category>
		<category><![CDATA[fetch record from typed dataset]]></category>
		<category><![CDATA[fill dataset]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[use typed dataset]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-use-typed-dataset-in-asp-net</guid>
		<description><![CDATA[In my previous article, I discussed about creating Typed Dataset in Visual Studio. In this article, I will show you how can we use that Dataset to fetch data. In this article, I will show, you how to edit a particular record in that Dataset, binding that Dataset to any Data Binding Control, fetching any column value of any row. To create Typed Dataset, first see my article on How... <span class="meta-more"><a href="http://howtoideas.net/how-to-use-typed-dataset-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>In my previous article, I discussed about creating Typed Dataset in Visual Studio. In this article, I will show you how can we use that Dataset to fetch data. In this article, I will show, you how to edit a particular record in that Dataset, binding that Dataset to any Data Binding Control, fetching any column value of any row.    </p>
<p>To create Typed Dataset, first see my article on <a href="http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio" target="_blank">How To Create Typed Dataset In Visual Studio</a></p>
<p><strong>Instructions:</strong></p>
<ol>
<li>Create a new instance of that dataset in code.      <br /> <br />
<blockquote><code>myDataset ds = new myDataset();</code></p></blockquote>
</li>
<li>Now you have to bind data to this Dataset. For this, use SqlDataAdapter class to select all the data of the same Table, and fill this dataset.      <br /> <br />
<blockquote><code>SqlConnection con = new SqlConnection();          <br />con.ConnectionString = @&quot;Data Source=HOWTOIDEAS;Initial Catalog=HowToIdeas;User ID=RohitGarg;Password=sqlserver&quot;;           <br />if (con.State == System.Data.ConnectionState.Closed)           <br />&#160;&#160;&#160; con.Open();           <br />SqlCommand cmd = new SqlCommand();           <br />cmd.CommandText = &quot;select * from [abc]&quot;;           <br />cmd.Connection = con;           <br />SqlDataAdapter da = new SqlDataAdapter(cmd);           <br />myDataset ds = new myDataset();&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />da.Fill(ds, ds.Tables[0].TableName);</code></p></blockquote>
</li>
<li>Once you fill the Dataset, you are ready to use this any way you like. </li>
<li>You can bind this Dataset to any Data Binding control, by providing this Dataset as <em>DataSource</em> for that Data Binding control. Here is an example of binding the data in Repeater control       <br /> <br />
<blockquote><code>Repeater1.DataSource = ds;          <br />Repeater1.DataBind();</code></p></blockquote>
<p><a href="http://howtoideas.net/wp-content/uploads/2011/05/image32.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Bind Typed Dataset To Data Binding Control" border="0" alt="Bind Typed Dataset To Data Binding Control" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb32.png" width="404" height="179" /></a> </li>
<li>To edit a particular column value of particular row, try the following code.      <br /> <br />
<blockquote><code>ds.abc[2].Eadd = &quot;My Address&quot;;</code></p></blockquote>
</li>
<li>In upper line of code, <em>2</em> is the index of the row whose Eadd column’s value we want to edit. Here is the output in browser       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image33.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Edit Value In Typed Dataset" border="0" alt="Edit Value In Typed Dataset" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb33.png" width="404" height="159" /></a> </li>
<li>If you want to fetch value of any column, you can do so by using following code      <br /> <br />
<blockquote><code>string s = ds.abc[1].Ename;          <br />Response.Write(&quot;Fetched Value Is : &quot; + s);</code></p></blockquote>
</li>
<li>In upper line, I have fetched the Ename column value of the row having index 1 or 2nd row. and then I have printed the fetched value on the page using <em>Response.Write</em> function.       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image34.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Fetch Data From Typed Dataset" border="0" alt="Fetch Data From Typed Dataset" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb34.png" width="404" height="216" /></a> </li>
</ol>
<div align="left"><h4>Incoming search terms:</h4></div><ul><li>how to use dataset in asp net (12)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-use-typed-dataset-in-asp-net/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How To Create Typed Dataset In Visual Studio</title>
		<link>http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio</link>
		<comments>http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio#comments</comments>
		<pubDate>Sat, 07 May 2011 13:09:00 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[add dataset]]></category>
		<category><![CDATA[add or delete columns from dataset]]></category>
		<category><![CDATA[add tables to dataset]]></category>
		<category><![CDATA[create dataset]]></category>
		<category><![CDATA[dataset designer]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[to]]></category>
		<category><![CDATA[typed dataset]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio</guid>
		<description><![CDATA[In .NET we have two kinds of Datasets, one is Typed Dataset and second is Untyped Dataset. Untyped Dataset are create at run time using code but Typed Dataset are created during design time and these exists as a file in your Website. You can add Tables, Views, etc. to Typed Dataset as many as you like. Once you are done, you can create new instance of this Typed Dataset... <span class="meta-more"><a href="http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>In <strong>.NET </strong>we have two kinds of <strong>Datasets</strong>, one is Typed Dataset and second is <strong>Untyped Dataset</strong>. <strong>Untyped Dataset </strong>are create at run time using code but <strong>Typed Dataset </strong>are created during design time and these exists as a file in your Website. You can add Tables, Views, etc. to <strong>Typed Dataset </strong>as many as you like. Once you are done, you can create new instance of this <strong>Typed Dataset </strong>in your code and can use it any way you like. In this article, I will only discuss about How can we create these <strong>Typed Dataset </strong>in <strong>Visual Studio</strong>.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>Open Visual Studio and create a website or open any existing one. </li>
<li>Open Solution Explorer and then right click on your Website and select <strong>Add New Item</strong>.       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image24.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add New Item" border="0" alt="Add New Item" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb24.png" width="304" height="275" /></a> </li>
<li>In the <strong>Add New Item </strong>dialogue, Select <strong>Dataset</strong> and give it any name you like and click <strong>Add</strong>.       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image25.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add New Dataset" border="0" alt="Add New Dataset" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb25.png" width="604" height="392" /></a> </li>
<li>If Visual Studio prompts you to add this Dataset in App_Code folder, just click <strong>Yes</strong> to continue.       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image26.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add Dataset To App_Code Folder" border="0" alt="Add Dataset To App_Code Folder" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb26.png" width="354" height="148" /></a> </li>
<li>After this Visual Studio will open Dataset Designer for your Newly created Dataset. Now what you have to do is, drag and drop table, views, etc. from Server Explorer to this designer and Visual Studio will do all the work to bind those tables to your Dataset. </li>
<li>So, to add Tables, open Solution Explorer and then explore your Database there, select the Table you want to add and then drag and drop that Table to Dataset Designer      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image27.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Drag And Drop Your Table To Dataset Designer" border="0" alt="Drag And Drop Your Table To Dataset Designer" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb27.png" width="304" height="224" /></a> </li>
<li>After this Visual Studio will show you the Table Columns and a Bind_Data function to fill the Dataset in the Designer.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image28.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Table In Dataset Designer" border="0" alt="Table In Dataset Designer" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb28.png" width="204" height="166" /></a> </li>
<li>If you want to remove or add any column to this, you can do so this as well. Right click on your Table in the Dataset Designer and the select Add-&gt;Column. There are some other options as well to select and configure your Dataset table. You can also delete Table here.      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image29.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Add A Column" border="0" alt="Add A Column" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb29.png" width="404" height="246" /></a>       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image30.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Delete A Column" border="0" alt="Delete A Column" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb30.png" width="254" height="307" /></a>       <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image31.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Set A Column As Primary Key" border="0" alt="Set A Column As Primary Key" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb31.png" width="254" height="309" /></a> </li>
</ol>
<p>Now To Use this Dataset in Code, You can see my Article On <a href="http://howtoideas.net/how-to-use-typed-dataset-in-asp-net" target="_blank">How To Use Typed Dataset In Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-create-typed-dataset-in-visual-studio/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Bind Data To Repeater In ASP.NET</title>
		<link>http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net#comments</comments>
		<pubDate>Wed, 04 May 2011 18:03:19 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[bind data to repeater]]></category>
		<category><![CDATA[data binding]]></category>
		<category><![CDATA[data binding in repeater]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[repeater]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net</guid>
		<description><![CDATA[Here is my first article on Binding Data to Repeater control in ASP.NET. Before starting, I would like to discuss about some of the properties of Repeater control, which makes it different from other Data Binding Controls like DataList, GridView, FormView, etc.. Repeater control doesn’t have any User Interface to define layout of the control. Like in GridView, DataList, etc., you can open task list and then can choose default... <span class="meta-more"><a href="http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p>Here is my first article on <strong>Binding Data to Repeater</strong> control in <strong>ASP.NET</strong>. Before starting, I would like to discuss about some of the properties of <strong>Repeater control</strong>, which makes it different from other <strong>Data Binding Controls</strong> like DataList, GridView, FormView, etc..</p>
<ul>
<li>Repeater control doesn’t have any User Interface to define layout of the control. Like in GridView, DataList, etc., you can open task list and then can choose default template for that control. In Repeater control, you have to describe in HTML only, that how your data should be represented to user when data binding occurs. </li>
<li>This control doesn’t have built in support for Paging like GridView has. DataList too don’t have built in support for Paging. But for both we can enable Paging by some other methods that are beyond the scope of this article, and I will try to cover them soon. </li>
<li>This Control displays data in a single column. Now here what Single Column means is, this control can’t create columns on its own, but if we want to create columns, we have to define a table inside this control which will be available in the only column this control have, but that table on its own can have multiple columns to display data categorized. In the following example, I will show you how to do this thing. DataList have built in support for dividing data in columns, and controls like GridView too have some advanced features based on these concepts. </li>
</ul>
<p>Now before starting, I want to write about what I will be doing in the following example. In following example, I will be using a class Employees with properties like Employee ID, Employee Name, Employee Address. In the Page Load event, I will be creating a List of this Employees class, and will add some Employee’s information to that list. and then I will bind that data to Repeater and in Repeater I will show this data in columns, first column for Employee ID, 2nd for Employee name, 3rd for Employee Address. And also I will add two horizontal lines between two records two separate them for clear view.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>Start by creating a Class for your Webpage. For example purpose, I have created an Employee class with three private Fields (eid – Int32, ename – string, eadd – string), three public properties with get element to return the value stored in those private fields (Eid – Int32, Ename – string, Eadd – string). Then i have created a constructor with three parameters one for every field of the class, and then assign the value passed by user to the fields. You can download my sample project at the bottom of this page, which contains that Class as well.      </li>
<li>Now in the <strong>Page_Load</strong> event, I have created a List of this <em>Employee</em> class and added four record in that list. After that, I bind that List to the <strong>Repeater Control </strong>as follows       <br /> <br />
<blockquote><code>List&lt;Employees&gt; employees = new List&lt;Employees&gt;();          <br />employees.Add(new Employees(1, &quot;Rohit&quot;, &quot;abcd&quot;));           <br />employees.Add(new Employees(2, &quot;Ankur&quot;, &quot;bcde&quot;));           <br />employees.Add(new Employees(3, &quot;Navneet&quot;, &quot;cdef&quot;));           <br />employees.Add(new Employees(4, &quot;Vipul&quot;, &quot;defg&quot;));           <br />Repeater1.DataSource = employees;           <br />Repeater1.DataBind();</code></p></blockquote>
</li>
<li>Now in the Source View of the Page, I modified the Item Template to bind the data in the way I want. In <strong>Item Template </strong>for this <strong>Repeater Control, </strong>I have created a table with 50% width of the user screen and then in that table, I created a new row which contains three data cells, one for every property of the Employee class. </li>
<li>You can write simple HTML text the way you want, which will be shown as it is in the browser, but where you want to show data from the data source, you have provided, you have to Evaluate the value of the key whose data you want to display there. Say, if in a column you want to display the data of property <em>Eid</em>, you have to bind it there as follows       <br /> <br />
<blockquote><code>&lt;%#Eval(“Eid”)%&gt;</code></p></blockquote>
<p> Now using this you will be able to bind data to your Repeater Control the way you want, but obviously you need to have some good knowledge of HTML as well. </li>
<li>After that I have created <strong>SeparateTemplate</strong> for the <strong>Repeater Control </strong>and just added two horizontal lines to display information in readable form. As this template will be called after every ItemTemplate binding. </li>
<li>Here is my HTML code for the <strong>Repeater Control        <br /></strong><br />
<blockquote><code>&lt;asp:Repeater ID=&quot;Repeater1&quot; runat=&quot;server&quot;&gt;          <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ItemTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;table width=&quot;50%&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;ID:&lt;/b&gt;&lt;%#Eval(&quot;Eid&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Name:&lt;/b&gt;&lt;%#Eval(&quot;Ename&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;td width=&quot;33%&quot; align=&quot;left&quot;&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;b&gt;Address:&lt;/b&gt;&lt;%#Eval(&quot;Eadd&quot;)%&gt;&lt;/td&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/tr&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/table&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/ItemTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;SeparatorTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;hr /&gt;&lt;hr /&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/SeparatorTemplate&gt;           <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;/asp:Repeater&gt;</code></p></blockquote>
</li>
<li>Here is the snapshot of output in browser      <br /><a href="http://howtoideas.net/wp-content/uploads/2011/05/image14.png"><img style="background-image: none; border-right-width: 0px; margin: 5px auto; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Data Binding In Repeater Control - ASP.NET" border="0" alt="Data Binding In Repeater Control - ASP.NET" src="http://howtoideas.net/wp-content/uploads/2011/05/image_thumb14.png" width="574" height="238" /></a> </li>
</ol>
<p>You can download my sample code. <a href="http://howtoideas.net/wp-content/uploads/C Sharp Source Codes/Data Binding - Repeater - HowToIdeas.rar">Click Here To Download Sample Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-bind-data-to-repeater-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Clear Session Variables In ASP.NET</title>
		<link>http://howtoideas.net/how-to-clear-session-variables-in-asp-net</link>
		<comments>http://howtoideas.net/how-to-clear-session-variables-in-asp-net#comments</comments>
		<pubDate>Fri, 29 Apr 2011 10:12:30 +0000</pubDate>
		<dc:creator>Rohit</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP]]></category>
		<category><![CDATA[clear session]]></category>
		<category><![CDATA[clear single session variable]]></category>
		<category><![CDATA[how]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[session variables]]></category>
		<category><![CDATA[to]]></category>

		<guid isPermaLink="false">http://howtoideas.net/how-to-clear-session-variables-in-asp-net</guid>
		<description><![CDATA[Session in ASP.NET is a way to store user specific information on Server side which will not be visible to User in any form and its all up to you how you want to use Session to store User Information. As these Session variables consume some disk space on your Server, so you should Clear all those Session variables which are of no use. Instructions: If you want to Clear... <span class="meta-more"><a href="http://howtoideas.net/how-to-clear-session-variables-in-asp-net">Read more &#187;</a></span>]]></description>
				<content:encoded><![CDATA[<p><strong><a href="http://msdn.microsoft.com/en-us/library/ms178581.aspx" target="_blank">Session</a> </strong>in ASP.NET is a way to store user specific information on <strong>Server</strong> side which will not be visible to <strong>User</strong> in any form and its all up to you how you want to use <strong>Session</strong> to store <strong>User Information</strong>. As these <strong>Session</strong> variables consume some disk space on your <strong>Server</strong>, so you should <strong>Clear all those Session variables</strong> which are of no use.</p>
<p><strong>Instructions:</strong></p>
<ol>
<li>If you want to Clear all the <strong>Session</strong> variables you have created, you can use any of the following command.       <br /> <br />
<blockquote><code>Session.Clear();</code></p></blockquote>
<p> or       <br /> <br />
<blockquote><code>Session.RemoveAll();</code></p></blockquote>
</li>
<li>Upper lines of code will clear all the <strong>Session</strong> variables but Session is still open for the user. So, if any time you want to close the <strong>Session</strong> for a user, you have to abandon it by using following command.       <br /> <br />
<blockquote><code>Session.Abandon();</code></p></blockquote>
</li>
<li>If you want to remove a particular variable from <strong>Session</strong> not all, then you have to use <em>Remove </em>method of <strong>Session</strong> class.       <br /> <br />
<blockquote><code>Session.Remove(“variable_name”);</code></p></blockquote>
</li>
</ol>
<p><a href="http://howtoideas.net/wp-content/uploads/2011/04/image118.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Clear Session Variables In ASP.NET" border="0" alt="Clear Session Variables In ASP.NET" src="http://howtoideas.net/wp-content/uploads/2011/04/image_thumb115.png" width="244" height="115" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://howtoideas.net/how-to-clear-session-variables-in-asp-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
