<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>gridview &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/gridview/</link>
	<description>Feed of posts on WordPress.com tagged "gridview"</description>
	<pubDate>Sat, 28 Nov 2009 21:45:42 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Basic Table/GridView manipulation using jQuery]]></title>
<link>http://ashfaqasp.wordpress.com/2009/11/27/basic-tablegridview-manipulation-using-jquery/</link>
<pubDate>Fri, 27 Nov 2009 15:11:58 +0000</pubDate>
<dc:creator>Ashfaq</dc:creator>
<guid>http://ashfaqasp.wordpress.com/2009/11/27/basic-tablegridview-manipulation-using-jquery/</guid>
<description><![CDATA[I used this jQuery function to find out the sum of a certain column in asp.net GridView, this is a g]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p> I used this jQuery function to find out the sum of a certain column in asp.net GridView, this is a good start from where you can traverse all row of GridView and do the manipulation.</p>
<p><code>
<pre>

function gridValueRecalculate() {
    var grdTotalSum = 0;
    var $idattr;
    var changeStatus = '';
    $("#GridView1 &#62; tbody &#62; tr &#62; td ").each(function() {

        $idattr = $(this).find(".TextBoxRight");
        // var currval = $idattr.val();
        if ($idattr.val() &#62; 0) {

            grdTotalSum = grdTotalSum + parseFloat($idattr.val());
            $('#txtGridTotal').val(grdTotalSum.toFixed(2));
            changeStatus = 'change'

        }
    });

    if (changeStatus == 'change') {
        fnCalculateLastBillAmount();
    }
}
</pre>
<p></code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Hide/Change Sort expression link in gridview]]></title>
<link>http://ramanisandeep.wordpress.com/2009/11/27/hidechange-sort-expression-link-in-gridview/</link>
<pubDate>Fri, 27 Nov 2009 10:23:15 +0000</pubDate>
<dc:creator>ramanisandeep</dc:creator>
<guid>http://ramanisandeep.wordpress.com/2009/11/27/hidechange-sort-expression-link-in-gridview/</guid>
<description><![CDATA[Today I was reading www.asp.net forums for some Q/A  &amp; I found one interesting Query regarding G]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Today I was reading www.asp.net forums for some Q/A  &#38; I found one interesting Query regarding Gridview sorting. So I feel that let me share it with others also.</p>
<p><span style="color:#008080;"><strong>Query Posted by Kamran Shahid</strong></span></p>
<p style="padding-left:30px;">I am using built in sorting in gridview. The links on the headers column shows like</p>
<p style="padding-left:30px;"><em>javascript:__doPostBack(&#8216;GridView1&#8242;,&#8217;Sort$au_fname&#8217;) </em></p>
<p style="padding-left:30px;">Is tehre any way I can change the display of that link like for example it may show # or au_fname only.</p>
<p><span style="color:#008080;"><strong>Solutions by Imran Baloch </strong></span></p>
<p><span style="color:#003366;"><strong>With JQuery</strong></span></p>
<pre class="brush: jscript;">
&#60;script language=&#34;javascript&#34;&#62;
$(function(){
    $(&#34;a[href]&#34;).each(function(n){
        if(this.href.indexOf(&#34;GridView1&#34;)&#62;-1)
        {
            var a=this.href;
            this.href=&#34;#&#34;;
            $(this).click(function(event){
                this.href=a;
            });
        }
    });
});
&#60;/script&#62;
</pre>
<p><span style="color:#003366;"><strong>Without JQuery</strong></span></p>
<pre class="brush: jscript;">
&#60;script language=&#34;javascript&#34;&#62;
 var tags = document.getElementsByTagName('a');
 for (var i=0; i &#60; tags.length; i++)
 {
      if(tags[i].href.indexOf(&#34;GridView1&#34;)&#62;-1)
      {
            tags[i].custom1=tags[i].href;
            tags[i].href=&#34;#&#34;;
            tags[i].onclick=function(event){
                alert(this.custom1);
                thisthis.href=this.custom1;
            }
      }
 }
&#60;/script&#62;  
</pre>
<p>Hope this will help !!!</p>
<p>Happy Programming</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Menjalankan Store Procedure di asp.net]]></title>
<link>http://ndereklangkung.wordpress.com/2009/11/26/menjalankan-store-procedure-di-asp-net/</link>
<pubDate>Thu, 26 Nov 2009 06:55:46 +0000</pubDate>
<dc:creator>ndereklangkung</dc:creator>
<guid>http://ndereklangkung.wordpress.com/2009/11/26/menjalankan-store-procedure-di-asp-net/</guid>
<description><![CDATA[Download Sample Selama ini dalam aplikasi web yang aku buat, aku gak pernah menggunakan / menjalanka]]></description>
<content:encoded><![CDATA[Download Sample Selama ini dalam aplikasi web yang aku buat, aku gak pernah menggunakan / menjalanka]]></content:encoded>
</item>
<item>
<title><![CDATA[Gridview Paging Error]]></title>
<link>http://kphebert.wordpress.com/2009/11/25/gridview-paging-error/</link>
<pubDate>Wed, 25 Nov 2009 20:11:17 +0000</pubDate>
<dc:creator>kphebert</dc:creator>
<guid>http://kphebert.wordpress.com/2009/11/25/gridview-paging-error/</guid>
<description><![CDATA[Index was out of range. Must be non-negative and less than the size of the collection. This error ju]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><blockquote><p>Index was out of range. Must be non-negative and less than the size of the collection.</p></blockquote>
<p>This error just greeted me while testing a log page that uses an ASP.NET GridView control for displaying tabular data.  When navigating to the last page and then trying to navigate back up to a more recent page, my code was failing on a line in the RowCommand event, which seemed strange to me.  Then, I realized that the pager is in the header, which is a row, itself, and any actions on the header row go through the RowCommand function and the code was failing on a call to set thisRow = gv.rows(e.CommandArgument mod gv.PageSize).  When the header row calls the RowCommand function, e.CommandArgument = -1, apparently.</p>
<p>A couple of solutions are:</p>
<ol>
<li>Wrap the entire contents of the RowCommand function with an if-statement to check for e.CommandArgument &#62; -1</li>
<li>Wrap the contents of the RowCommand function with an if-statement to check for e.CommandName = &#8220;Page&#8221;</li>
</ol>
<p>I found solution 2 on a message board.  Apparently, when you&#8217;re clicking on one of the pager buttons in the header, the CommandName is set to &#8220;Page&#8221;.</p>
<p>This has taken about 2 hours to troubleshoot, and the solution was simple&#8211;yet another A-S-S (Always Something Simple) solution&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Change Background color of last updated record in Gridview in Asp.net]]></title>
<link>http://pankajlalwani.wordpress.com/2009/11/24/change-background-color-of-last-updated-record-in-gridview-in-asp-net/</link>
<pubDate>Tue, 24 Nov 2009 05:26:28 +0000</pubDate>
<dc:creator>pankajlalwani</dc:creator>
<guid>http://pankajlalwani.wordpress.com/2009/11/24/change-background-color-of-last-updated-record-in-gridview-in-asp-net/</guid>
<description><![CDATA[Here in this post,i m gonna show how to change background color of last updated record in gridview. ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Here in this post,i m gonna show how to change background color of last updated record in gridview.</p>
<p>Normally what happens after we have updated any record we redirect or bind grid again, so grid comes to first page and we dont know which record we updated if there are many records.</p>
<p>Lets say we have a gridview with 15 records and paging of 5.</p>
<p>If we go to page 2 and click on &#8220;edit&#8221; link of 8th record in gridview and update that record, now after that we have to change the background row color of 8th record in gridview on 2nd page. So for that we have to maintain the primary key of that record and page index in session whenever we call edit method.</p>
<p>Now on gridview row databound you have to do this code:</p>
<p>protected void Gv_RowDataBound(object sender, GridViewRowEventArgs e)<br />
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{<br />
int id = Convert.ToInt32(Gv.DataKeys[e.Row.RowIndex].Value.ToString());<br />
if (id == Convert.ToInt32(Session["pkid"]))<br />
e.Row.CssClass = &#8220;UpdateRecordCss&#8221;;</p>
<p>}</p>
<p>}</p>
<p>also after binding grid you have to maintain page index</p>
<p>BindDetails();<br />
GvMake.PageIndex = Convert.ToInt32(Session["pgindex"]);</p>
<p>Css for that is as follows:</p>
<p>.UpdateRecordCss td<br />
{</p>
<p>background-color: Green;<br />
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=&#8217;#B09900&#8242;,EndColorStr=&#8217;#FFF192&#8242;); /*FILTER: progid:DXImageTransform.Microsoft.Alpha( style=1,opacity=25,finishOpacity=100,startX=0,finishX=100,startY=100,finishY=0);*/<br />
}</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[GridView CommadField type image causing double postback]]></title>
<link>http://kirandotnet.wordpress.com/2009/11/21/gridview-commadfield-type-image-causing-double-postback/</link>
<pubDate>Sat, 21 Nov 2009 16:09:59 +0000</pubDate>
<dc:creator>kirandotnet</dc:creator>
<guid>http://kirandotnet.wordpress.com/2009/11/21/gridview-commadfield-type-image-causing-double-postback/</guid>
<description><![CDATA[Recently working with one of the asp.net applicationI just noticed that clicking on CommadFiled Colu]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Recently working with one of the asp.net applicationI just noticed that clicking on CommadFiled Column image icon causing the page posted back twice.<br />
In first postback the Page.IsPostBack was false and in second postback the Page.IsPostBack was true. </p>
<p>Surprisingly the issue is only on internet explorer 8. In firefox and IE6 it was working fine as expected.</p>
<p>Googling it for a while i found it is known bug submited to microsoft.<br />
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105123</p>
<p>They said its fixed, but event if I am using .Net framework 3.5 SP1, the issue is still there.</p>
<p>Anyway I tried a workaround suggested there, and converted the commadfield to templated field with image buttons. which solves it</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ASP.NET GridView makeover using CSS]]></title>
<link>http://kmorgan26.wordpress.com/2009/11/18/asp-net-gridview-makeover-using-css/</link>
<pubDate>Thu, 19 Nov 2009 02:05:55 +0000</pubDate>
<dc:creator>kmorgan26</dc:creator>
<guid>http://kmorgan26.wordpress.com/2009/11/18/asp-net-gridview-makeover-using-css/</guid>
<description><![CDATA[A very useful and well written article demonstrating how to use CSS to style an ASP.net Gridview Con]]></description>
<content:encoded><![CDATA[A very useful and well written article demonstrating how to use CSS to style an ASP.net Gridview Con]]></content:encoded>
</item>
<item>
<title><![CDATA[Formatting Date Strings in ASP.NET Gridviews]]></title>
<link>http://kphebert.wordpress.com/2009/11/17/formatting-date-strings-in-asp-net-gridviews/</link>
<pubDate>Tue, 17 Nov 2009 16:55:20 +0000</pubDate>
<dc:creator>kphebert</dc:creator>
<guid>http://kphebert.wordpress.com/2009/11/17/formatting-date-strings-in-asp-net-gridviews/</guid>
<description><![CDATA[I&#8217;m blogging about this as it is a constant speedbump I find myself crossing. We&#8217;ve been]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I&#8217;m blogging about this as it is a constant speedbump I find myself crossing. We&#8217;ve been using TemplateFields in gridviews exclusively for a couple of years now since we&#8217;ve always found ourselves having to convert BoundFields to TemplateFields in order to get extra functionality that we need in most cases. There&#8217;s extra coding to do, but we only use what we need, and, thus, i&#8217;m assuming that it&#8217;s a little more efficient. I&#8217;ll reasearch the topic and include it in another blog.</p>
<p>If, in the item template, a label is used to display text, I&#8217;ve gone around-and-around, via trial and error, trying to display dates with the short date format. Today I stumbled upon a link that provides solutions for both BoundFields &#38; labels inside of TemplateFields: <a href="http://www.codedigest.com/Articles/ASPNET/137_How_to_format_DateTime_in_GridView_BoundColumn_and_TemplateColumn.aspx">http://www.codedigest.com/Articles/ASPNET/137_How_to_format_DateTime_in_GridView_BoundColumn_and_TemplateColumn.aspx</a></p>
<p>The solution for the label inside of the TemplateField, which I&#8217;m most concerned about here, is:</p>
<ol>
<li>Be sure to use Eval rather than Bind (I always use Bind&#8211;this was the &#8216;Gotcha!&#8217;) in the text property of the label</li>
<li>in Eval, include the format string in the second parameter (i.e.  Eval(&#8220;Field_Name&#8221;, &#8220;{0:d}&#8221;) )</li>
</ol>
<p>That was a simple fix that took me 2 hours of trial and error to get nowhere before finally searching for a solution elsewhere!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using Enum in Gridview in Asp.net]]></title>
<link>http://pankajlalwani.wordpress.com/2009/11/17/using-enum-in-gridview-in-asp-net/</link>
<pubDate>Tue, 17 Nov 2009 05:25:18 +0000</pubDate>
<dc:creator>pankajlalwani</dc:creator>
<guid>http://pankajlalwani.wordpress.com/2009/11/17/using-enum-in-gridview-in-asp-net/</guid>
<description><![CDATA[Lets say we want to bind a gridview with table having Fields 1) Customer Name 2) Category Now in the]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Lets say we want to bind a gridview with table having Fields</p>
<p>1) Customer Name</p>
<p>2) Category</p>
<p>Now in the database Category field is stored as tiny int like 0 or 1 or 2</p>
<p>0 Stands for Sales</p>
<p>1 Stands for Marketing</p>
<p>2 Stands for Production</p>
<p>So, now when the gridview is bind, it will display o,1 values. instead of this we want their respective category name to be displayed.</p>
<p>For this we define a ENUM as follows</p>
<p>public enum Category<br />
{</p>
<p>Sales= 0,</p>
<p>Marketing= 1,</p>
<p>Production= 2<br />
}</p>
<p>Now in the gridview source in the template field write this code.</p>
<p>&#60;asp:TemplateField HeaderText=&#8221;Category&#8221;&#62;<br />
&#60;ItemTemplate&#62;<br />
&#60;div&#62;<br />
&#60;%# Enum.GetName(typeof(GlobalLibrary.Constants.Category),Convert.ToInt32(Eval(&#8220;Category&#8221;))) %&#62;<br />
&#60;/div&#62;<br />
&#60;/ItemTemplate&#62;<br />
&#60;/asp:TemplateField&#62;</p>
<p>Here in Globallibray.Constants is my project with Constants Class.. you can replace it with yours..</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Using ListView control]]></title>
<link>http://zamjad.wordpress.com/2009/11/15/using-listview-control/</link>
<pubDate>Mon, 16 Nov 2009 04:14:30 +0000</pubDate>
<dc:creator>zamjad</dc:creator>
<guid>http://zamjad.wordpress.com/2009/11/15/using-listview-control/</guid>
<description><![CDATA[ListView control is inherited by ListBox class and it contains all the functionality of List Box cla]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>ListView control is inherited by ListBox class and it contains all the functionality of List Box class. Here is a class diagram of ListView class.</p>
<p><a href="http://zamjad.files.wordpress.com/2009/11/listbox1.gif"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="ListBox" border="0" alt="ListBox" src="http://zamjad.files.wordpress.com/2009/11/listbox_thumb1.gif?w=219&#038;h=402" width="219" height="402" /></a> </p>
<p>List view define a property View that define the presentation of the List view. WPF already provide one presentation for ListBox class named GridView. If we want to define our own presentation then we have to inherit our class from ViewBase class. ViewBase is an abstract class and View Property of ListView class has the ViewBase data type. Here is a class diagram to explain this. </p>
<p><a href="http://zamjad.files.wordpress.com/2009/11/listview.gif"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="ListView" border="0" alt="ListView" src="http://zamjad.files.wordpress.com/2009/11/listview_thumb.gif?w=717&#038;h=653" width="717" height="653" /></a> </p>
<p>Now lets take a look at simple usage of GridView class. Our C# code is very similar to List box example there&#160; we define list of string. Here is C# code of this.</p>
<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;background-color:#fbfbfb;min-height:40px;width:450px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding:5px;">
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  1: <span style="color:#0000ff;">using</span> System;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  2: <span style="color:#0000ff;">using</span> System.Collections.Generic;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  3: <span style="color:#0000ff;">using</span> System.Linq;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  4: <span style="color:#0000ff;">using</span> System.Text;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  5: <span style="color:#0000ff;">using</span> System.Windows;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  6: <span style="color:#0000ff;">using</span> System.Windows.Controls;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  7: <span style="color:#0000ff;">using</span> System.Windows.Data;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  8: <span style="color:#0000ff;">using</span> System.Windows.Documents;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  9: <span style="color:#0000ff;">using</span> System.Windows.Input;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 10: <span style="color:#0000ff;">using</span> System.Windows.Media;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 11: <span style="color:#0000ff;">using</span> System.Windows.Media.Imaging;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 12: <span style="color:#0000ff;">using</span> System.Windows.Navigation;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 13: <span style="color:#0000ff;">using</span> System.Windows.Shapes;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 14:
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 15: <span style="color:#0000ff;">namespace</span> UIElement
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 16: {
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 17:     <span style="color:#808080;">/// &#60;summary&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 18:     <span style="color:#808080;">/// Interaction logic for Window1.xaml</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 19:     <span style="color:#808080;">/// &#60;/summary&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 20:     <span style="color:#0000ff;">public</span> partial <span style="color:#0000ff;">class</span> Window1 : Window
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 21:     {
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 22:         <span style="color:#0000ff;">public</span> List&#60;String&#62; items
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 23:         { <span style="color:#0000ff;">get</span>; <span style="color:#0000ff;">set</span>; }
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 24:
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 25:         <span style="color:#0000ff;">public</span> Window1()
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 26:         {
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 27:             InitializeComponent();
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 28:
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 29:             items = <span style="color:#0000ff;">new</span> List&#60;<span style="color:#0000ff;">string</span>&#62;();
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 30:             items.Add(&#34;<span style="color:#8b0000;">Maryland</span>&#34;);
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 31:             items.Add(&#34;<span style="color:#8b0000;">California</span>&#34;);
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 32:             items.Add(&#34;<span style="color:#8b0000;">Taxes</span>&#34;);
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 33:             items.Add(&#34;<span style="color:#8b0000;">Washington</span>&#34;);
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 34:             items.Add(&#34;<span style="color:#8b0000;">Virginia</span>&#34;);
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 35:
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 36:             list.ItemsSource = items;
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 37:         }
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 38:     }
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 39: }
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 40: </pre>
</pre>
<p>Here is XAML code of our project.</p>
<pre style="border-bottom:#cecece 1px solid;border-left:#cecece 1px solid;background-color:#fbfbfb;min-height:40px;width:450px;overflow:auto;border-top:#cecece 1px solid;border-right:#cecece 1px solid;padding:5px;">
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  1: <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">Window</span> <span style="color:#ff0000;">x</span>:<span style="color:#ff0000;">Class</span>=<span style="color:#0000ff;">&#34;UIElement.Window1&#34;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  2:     <span style="color:#ff0000;">xmlns</span>=<span style="color:#0000ff;">&#34;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#34;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  3:     <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">x</span>=<span style="color:#0000ff;">&#34;http://schemas.microsoft.com/winfx/2006/xaml&#34;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  4:     <span style="color:#ff0000;">xmlns</span>:<span style="color:#ff0000;">local</span>=<span style="color:#0000ff;">&#34;clr-namespace:UIElement&#34;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  5:     <span style="color:#ff0000;">Title</span>=<span style="color:#0000ff;">&#34;ListView Example&#34;</span> <span style="color:#ff0000;">Height</span>=<span style="color:#0000ff;">&#34;300&#34;</span> <span style="color:#ff0000;">Width</span>=<span style="color:#0000ff;">&#34;400&#34;</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  6:     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">Grid</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  7:         <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">ListView</span> <span style="color:#ff0000;">Name</span>=<span style="color:#0000ff;">&#34;list&#34;</span> <span style="color:#ff0000;">Margin</span>=<span style="color:#0000ff;">&#34;5&#34;</span> <span style="color:#ff0000;">HorizontalContentAlignment</span>=<span style="color:#0000ff;">&#34;Stretch&#34;</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  8:             <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">ListView.View</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;">  9:                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">GridView</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 10:                     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">GridViewColumn</span> <span style="color:#ff0000;">Width</span>=<span style="color:#0000ff;">&#34;Auto&#34;</span> <span style="color:#ff0000;">Header</span>=<span style="color:#0000ff;">&#34;States Name&#34;</span> <span style="color:#ff0000;">DisplayMemberBinding</span>=<span style="color:#0000ff;">&#34;{Binding}&#34;</span><span style="color:#0000ff;">/&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 11:                 <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">GridView</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 12:             <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">ListView.View</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 13:         <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">ListView</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 14:     <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">Grid</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 15: <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">Window</span><span style="color:#0000ff;">&#62;</span>
</pre>
<pre style="background-color:#fbfbfb;width:100%;font-family:consolas,&#39;font-size:12px;margin:0;"> 16: </pre>
</pre>
<p>Here is the output of this program.</p>
<p><a href="http://zamjad.files.wordpress.com/2009/11/listviewoutput.gif"><img style="border-bottom:0;border-left:0;display:block;float:none;margin-left:auto;border-top:0;margin-right:auto;border-right:0;" title="ListViewOutput" border="0" alt="ListViewOutput" src="http://zamjad.files.wordpress.com/2009/11/listviewoutput_thumb.gif?w=400&#038;h=300" width="400" height="300" /></a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[MaxLength for DevExpress GridColumn or TextEdit components]]></title>
<link>http://welltechnically.com/2009/11/13/maxlength-for-devexpress-gridcolumn-or-textedit-components/</link>
<pubDate>Fri, 13 Nov 2009 01:04:53 +0000</pubDate>
<dc:creator>welltechnically</dc:creator>
<guid>http://welltechnically.com/2009/11/13/maxlength-for-devexpress-gridcolumn-or-textedit-components/</guid>
<description><![CDATA[We use and ♥ DevExpress controls! In WinForms, in ASP.net, in WPF, in anything! But every now and th]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>We use and ♥  DevExpress controls! In WinForms, in ASP.net, in WPF, in anything!</p>
<p>But every now and then you come across something that should be very simple to do, but it just isn&#8217;t so. So you just have to do things the hard way&#8230; this consumes time (to develop), this add complexity (to reading, understanding and debugging) and it adds noise (to the real logic and code).</p>
<p>One such little quirk that I&#8217;ve hit was that the GridColumn&#8217;s on the DevExpress GridControl/GridView have no way to set a MaxLength on the field. This is because they do not actually support editing but rather inherit this capability from a default BaseEdit instance within the cell.</p>
<p>The trick is then to grab this BaseEdit for the cell you want and set its MaxLength. The simplest and fastest was to do this is by using the GridView ShownEditor event as shown in this simple example.</p>
<pre>    private void gridViewItemList_ShownEditor(object sender, EventArgs e)
    {
        BaseEdit edit = ((BaseView) sender).ActiveEditor;
        GridView view = sender as GridView;

        if (view != null &#38;&#38; edit is TextEdit)
        {
            switch (view.FocusedColumn.FieldName)
            {
                case "Reorder":
                case "Code":
                    (edit as TextEdit).Properties.MaxLength = 25;
                    break;
                case "Alias":
                    (edit as TextEdit).Properties.MaxLength = 20;
                    break;
                case "Description":
                    (edit as TextEdit).Properties.MaxLength = 50;
                    break;

            }
        }
    }
</pre>
<p>Hopefully this helps as the alternative common approach is to create a repositoryItemTextEdit for each column, assign it to the column and then set up your repositoryItemTextEdit to behave the way you like, not nice if you have a few dozen columns !</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Respond to Button Events in a GridView Control]]></title>
<link>http://rthumati.wordpress.com/2009/11/12/respond-to-button-events-in-a-gridview-control/</link>
<pubDate>Thu, 12 Nov 2009 10:39:25 +0000</pubDate>
<dc:creator>ravivarmathumati</dc:creator>
<guid>http://rthumati.wordpress.com/2009/11/12/respond-to-button-events-in-a-gridview-control/</guid>
<description><![CDATA[When a button is clicked in a GridView control, the RowCommand event is raised. The GridView control]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">When a button is clicked in a GridView control, the RowCommand event is raised. The GridView control has built-in functionality for operations such as edit, delete, and paging. You can also add buttons and use the RowCommand event to add custom functionality to the control.</p>
<p style="text-align:justify;">You can add custom functionality to a GridView control in the following ways:</p>
<ul style="text-align:justify;">
<li>By adding a ButtonField field to the GridView control.</li>
<li>By adding a Button, LinkButton, or ImageButton controls to a template in the GridView control.</li>
</ul>
<p style="text-align:justify;">You can use the CommandName property of the event argument to identify the button&#8217;s function in the event handler method. If you are working with ButtonField or TemplateField objects, you can also use the CommandArgument property to identify the current row. When you are using a ButtonField object, the CommandArgument property is set automatically to the row index. When you are using a TemplateField object, the CommandArgument property is not automatically set by the control. In that case, if you have to determine the row index in the event handler, you can set the CommandArgument property of the button to the row index by using a data-binding expression.</p>
<h3 style="text-align:justify;">To respond to button events in the GridView control</h3>
<ol style="text-align:justify;">
<li>Set the button&#8217;s CommandName property to a string that identifies its function, such as &#8220;Print&#8221; or &#8220;Copy&#8221;.</li>
<li>If you are using the TemplateField object and have to access the row index in the event handler method set the button&#8217;s CommandArgument property to an expression that identifies the current row.</li>
</ol>
<p style="text-align:justify;">The following example shows how you can set the CommandArgument property of a button in a TemplateField column to the current row index. In the example, the column contains a Button control that displays a shopping cart.</p>
<p style="text-align:justify;">Visual Basic</p>
<pre style="text-align:justify;">&#60;asp:TemplateField&#62;</pre>
<pre style="text-align:justify;">  &#60;ItemTemplate&#62;</pre>
<pre style="text-align:justify;">    &#60;asp:Button runat="server"</pre>
<pre style="text-align:justify;">      CommandName="AddToCart"</pre>
<pre style="text-align:justify;"><strong>      CommandArgument="&#60;%# CType(Container,GridViewRow).RowIndex %&#62;"</strong></pre>
<pre style="text-align:justify;">      Text="Add to Cart" /&#62;</pre>
<pre style="text-align:justify;">  &#60;/ItemTemplate&#62;</pre>
<pre style="text-align:justify;">&#60;/asp:TemplateField&#62;</pre>
<p style="text-align:justify;">C#</p>
<pre style="text-align:justify;">&#60;asp:TemplateField&#62;</pre>
<pre style="text-align:justify;">  &#60;ItemTemplate&#62;</pre>
<pre style="text-align:justify;">    &#60;asp:Button runat="server"</pre>
<pre style="text-align:justify;">      CommandName="AddToCart"</pre>
<pre style="text-align:justify;"><strong>      CommandArgument="&#60;%# ((GridViewRow) Container).RowIndex %&#62;"</strong></pre>
<pre style="text-align:justify;">      Text="Add to Cart" /&#62;</pre>
<pre style="text-align:justify;">  &#60;/ItemTemplate&#62;</pre>
<pre style="text-align:justify;">&#60;/asp:TemplateField&#62;</pre>
<ol style="text-align:justify;">
<li>Create a method for the RowCommand event of the GridView control. In the method, do the following:
<ol>
<li>Check the CommandName property of the event-argument object to see what string was passed.</li>
<li>Retrieve the index of the row that contains the button by using the CommandArgument property, if required.</li>
<li>Perform the appropriate logic for the button that the user clicked.</li>
</ol>
</li>
</ol>
<p style="text-align:justify;">The following example shows how you can respond to a button click in a GridView control. In the example, a button in a TemplateField column sends the command &#8220;AddToCart&#8221;. The RowCommand event handler determines which button was clicked. If it was the shopping cart button, the code performs the appropriate logic.</p>
<p style="text-align:justify;">Visual Basic</p>
<pre style="text-align:justify;">Protected Sub GridView1_RowCommand(ByVal sender As Object, _</pre>
<pre style="text-align:justify;">  ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs)</pre>
<pre style="text-align:justify;">  If (e.CommandName = "AddToCart") Then</pre>
<pre style="text-align:justify;">    ' Retrieve the row index stored in the CommandArgument property.</pre>
<pre style="text-align:justify;">    Dim index As Integer = Convert.ToInt32(e.CommandArgument)</pre>
<pre style="text-align:justify;">    ' Retrieve the row that contains the button</pre>
<pre style="text-align:justify;">    ' from the Rows collection.</pre>
<pre style="text-align:justify;">    Dim row As GridViewRow = GridView1.Rows(index)</pre>
<pre style="text-align:justify;">    ' Add code here to add the item to the shopping cart.</pre>
<pre style="text-align:justify;">  End If</pre>
<pre style="text-align:justify;">End Sub</pre>
<p style="text-align:justify;">C#</p>
<pre style="text-align:justify;">protected void GridView1_RowCommand(object sender,</pre>
<pre style="text-align:justify;">  GridViewCommandEventArgs e)</pre>
<pre style="text-align:justify;">{</pre>
<pre style="text-align:justify;">  if (e.CommandName == "AddToCart")</pre>
<pre style="text-align:justify;">  {</pre>
<pre style="text-align:justify;">    // Retrieve the row index stored in the</pre>
<pre style="text-align:justify;">    // CommandArgument property.</pre>
<pre style="text-align:justify;">    int index = Convert.ToInt32(e.CommandArgument);</pre>
<pre style="text-align:justify;"></pre>
<pre style="text-align:justify;">    // Retrieve the row that contains the button</pre>
<pre style="text-align:justify;">    // from the Rows collection.</pre>
<pre style="text-align:justify;">    GridViewRow row = GridView1.Rows[index];</pre>
<pre style="text-align:justify;"></pre>
<pre style="text-align:justify;">    // Add code here to add the item to the shopping cart.</pre>
<pre style="text-align:justify;">  }</pre>
<pre style="text-align:justify;">  }</pre>
<p style="text-align:justify;">For an example that uses the ButtonField class, see the GridView..::.RowCommand event documentation.</p>
<p style="text-align:justify;"><strong>GridView&#8230;:: .RowCommand Event</strong></p>
<p style="text-align:justify;">Occurs when a button is clicked in a GridView control</p>
<p style="text-align:justify;"><strong>Namespace:</strong> System.Web.UI.WebControls</p>
<p style="text-align:justify;"><strong>Assembly:</strong> System.Web (in System.Web.dll)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Visual Basic (Declaration)</p>
<p style="text-align:justify;">Public Event RowCommand As GridViewCommandEventHandler</p>
<p style="text-align:justify;">Visual Basic (Usage)</p>
<p style="text-align:justify;">Dim instance As GridView</p>
<p style="text-align:justify;">Dim handler As GridViewCommandEventHandler</p>
<p style="text-align:justify;">
<p style="text-align:justify;">AddHandler instance.RowCommand, handler</p>
<p style="text-align:justify;">C#</p>
<p style="text-align:justify;">public event GridViewCommandEventHandler RowCommand</p>
<p style="text-align:justify;">Visual C++</p>
<p style="text-align:justify;">public:</p>
<p style="text-align:justify;">event GridViewCommandEventHandler^ RowCommand {</p>
<p style="text-align:justify;">void add (GridViewCommandEventHandler^ value);</p>
<p style="text-align:justify;">void remove (GridViewCommandEventHandler^ value);</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">JScript</p>
<p style="text-align:justify;">JScript does not support events.</p>
<p style="text-align:justify;">ASP.NET</p>
<p style="text-align:justify;">&#60;<strong>asp:GridView OnRowCommand=&#8221;GridViewCommandEventHandler&#8221; /&#62;</strong></p>
<p style="text-align:justify;">The <strong>RowCommand</strong> event is raised when a button is clicked in the GridView control. This enables you to provide an event-handling method that performs a custom routine whenever this event occurs.</p>
<p style="text-align:justify;">Buttons within a GridView control can also invoke some of the built-in functionality of the control. To perform one of these operations, set the <strong>CommandName</strong> property of a button to one of the values in the following table.</p>
<table style="text-align:justify;" border="1" cellpadding="0" width="97%">
<tbody>
<tr>
<td valign="bottom"><strong>CommandName   value</strong></td>
<td valign="bottom"><strong>Description</strong></td>
</tr>
<tr>
<td valign="top">&#8220;Cancel&#8221;</td>
<td valign="top">Cancels an edit operation and returns the GridView control to read-only mode.   Raises the RowCancelingEdit event.</td>
</tr>
<tr>
<td valign="top">&#8220;Delete&#8221;</td>
<td valign="top">Deletes the current record. Raises the RowDeleting and RowDeleted events.</td>
</tr>
<tr>
<td valign="top">&#8220;Edit&#8221;</td>
<td valign="top">Puts the current record in edit mode. Raises the RowEditing event.</td>
</tr>
<tr>
<td valign="top">&#8220;Page&#8221;</td>
<td valign="top">Performs a paging operation. Sets the <strong>CommandArgument</strong> property of the button to &#8220;First&#8221;, &#8220;Last&#8221;,   &#8220;Next&#8221;, &#8220;Prev&#8221;, or a page number to specify the type of   paging operation to perform. Raises the PageIndexChanging and PageIndexChanged events.</td>
</tr>
<tr>
<td valign="top">&#8220;Select&#8221;</td>
<td valign="top">Selects the current record. Raises the SelectedIndexChanging and SelectedIndexChanged events.</td>
</tr>
<tr>
<td valign="top">&#8220;Sort&#8221;</td>
<td valign="top">Sorts the GridView control. Raises the Sorting and Sorted events.</td>
</tr>
<tr>
<td valign="top">&#8220;Update&#8221;</td>
<td valign="top">Updates the current record in the data source. Raises the RowUpdating and RowUpdated events.</td>
</tr>
</tbody>
</table>
<p style="text-align:justify;">Although the <strong>RowCommand</strong> event is raised when a button listed in the previous table is clicked, it is recommended that you use the events listed in the table for the operation.</p>
<p style="text-align:justify;">A GridViewCommandEventArgs object is passed to the event-handling method, which enables you to determine the command name and command argument of the button clicked.</p>
<table style="text-align:justify;" border="1" cellpadding="0" width="97%">
<tbody>
<tr>
<td valign="bottom"><strong>Note:</strong></td>
</tr>
<tr>
<td valign="top">To determine the index of the row that raised the event,   use the CommandArgument property of the event argument   that is passed to the event. The ButtonField class automatically populates the CommandArgument property with the appropriate   index value. For other command buttons, you must manually set the CommandArgument property of the command button.   For example, you can set the CommandArgument to &#60;%# Container.DataItemIndex %&#62; when the GridView control has no paging enabled.</td>
</tr>
</tbody>
</table>
<p style="text-align:justify;">Examples</p>
<p style="text-align:justify;">The following example demonstrates how to use the <strong>RowCommand</strong> event to add the name of a customer from a GridView control to a ListBox control when a row&#8217;s Add button is clicked.</p>
<p style="text-align:justify;">Visual Basic</p>
<p style="text-align:justify;">&#60;%@ Page language=&#8221;VB&#8221; %&#62;</p>
<p style="text-align:justify;">&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</p>
<p style="text-align:justify;">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62;</p>
<p style="text-align:justify;">&#60;script runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Sub ContactsGridView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; If multiple buttons are used in a GridView control, use the</p>
<p style="text-align:justify;">&#8216; CommandName property to determine which button was clicked.</p>
<p style="text-align:justify;">If e.CommandName = &#8220;Add&#8221; Then</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Convert the row index stored in the CommandArgument</p>
<p style="text-align:justify;">&#8216; property to an Integer.</p>
<p style="text-align:justify;">Dim index As Integer = Convert.ToInt32(e.CommandArgument)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Retrieve the row that contains the button clicked</p>
<p style="text-align:justify;">&#8216; by the user from the Rows collection.</p>
<p style="text-align:justify;">Dim row As GridViewRow = ContactsGridView.Rows(index)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Create a new ListItem object for the contact in the row.</p>
<p style="text-align:justify;">Dim item As New ListItem()</p>
<p style="text-align:justify;">item.Text = Server.HtmlDecode(row.Cells(2).Text) &#38; &#8221; &#8221; &#38; _</p>
<p style="text-align:justify;">Server.HtmlDecode(row.Cells(3).Text)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; If the contact is not already in the ListBox, add the ListItem</p>
<p style="text-align:justify;">&#8216; object to the Items collection of the ListBox control.</p>
<p style="text-align:justify;">If Not ContactsListBox.Items.Contains(item) Then</p>
<p style="text-align:justify;">
<p style="text-align:justify;">ContactsListBox.Items.Add(item)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">End If</p>
<p style="text-align:justify;">
<p style="text-align:justify;">End If</p>
<p style="text-align:justify;">
<p style="text-align:justify;">End Sub</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/script&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;html  &#62;</p>
<p style="text-align:justify;">&#60;head id=&#8221;Head1&#8243; runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;title&#62;GridView RowCommand Example&#60;/title&#62;</p>
<p style="text-align:justify;">&#60;/head&#62;</p>
<p style="text-align:justify;">&#60;body&#62;</p>
<p style="text-align:justify;">&#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;h3&#62;GridView RowCommand Example&#60;/h3&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;table width=&#8221;100%&#8221;&#62;</p>
<p style="text-align:justify;">&#60;tr&#62;</p>
<p style="text-align:justify;">&#60;td style=&#8221;width:50%&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;asp:gridview id=&#8221;ContactsGridView&#8221;</p>
<p style="text-align:justify;">datasourceid=&#8221;ContactsSource&#8221;</p>
<p style="text-align:justify;">allowpaging=&#8221;true&#8221;</p>
<p style="text-align:justify;">autogeneratecolumns=&#8221;false&#8221;</p>
<p style="text-align:justify;">onrowcommand=&#8221;ContactsGridView_RowCommand&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;columns&#62;</p>
<p style="text-align:justify;">&#60;asp:buttonfield buttontype=&#8221;Link&#8221;</p>
<p style="text-align:justify;">commandname=&#8221;Add&#8221;</p>
<p style="text-align:justify;">text=&#8221;Add&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;ContactID&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;Contact ID&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;FirstName&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;First Name&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;LastName&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;Last Name&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;/columns&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/asp:gridview&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/td&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;td style=&#8221;vertical-align:top; width:50%&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Contacts: &#60;br/&#62;</p>
<p style="text-align:justify;">&#60;asp:listbox id=&#8221;ContactsListBox&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221; Height=&#8221;200px&#8221; Width=&#8221;200px&#8221;/&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/td&#62;</p>
<p style="text-align:justify;">&#60;/tr&#62;</p>
<p style="text-align:justify;">&#60;/table&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!&#8211; This example uses Microsoft SQL Server and connects    &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; to the AdventureWorks sample database. Use an ASP.NET  &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; expression to retrieve the connection string value     &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; from the Web.config file.                              &#8211;&#62;</p>
<p style="text-align:justify;">&#60;asp:sqldatasource id=&#8221;ContactsSource&#8221;</p>
<p style="text-align:justify;">selectcommand=&#8221;Select [ContactID], [FirstName], [LastName] From Person.Contact&#8221;</p>
<p style="text-align:justify;">connectionstring=&#8221;&#60;%$ ConnectionStrings:AdventureWorks_DataConnectionString%&#62;&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;/&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/form&#62;</p>
<p style="text-align:justify;">&#60;/body&#62;</p>
<p style="text-align:justify;">&#60;/html&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">C#</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;%@ Page language=&#8221;C#&#8221; %&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</p>
<p style="text-align:justify;">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62;</p>
<p style="text-align:justify;">&#60;script runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">void ContactsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)</p>
<p style="text-align:justify;">{</p>
<p style="text-align:justify;">// If multiple buttons are used in a GridView control, use the</p>
<p style="text-align:justify;">// CommandName property to determine which button was clicked.</p>
<p style="text-align:justify;">if(e.CommandName==&#8221;Add&#8221;)</p>
<p style="text-align:justify;">{</p>
<p style="text-align:justify;">// Convert the row index stored in the CommandArgument</p>
<p style="text-align:justify;">// property to an Integer.</p>
<p style="text-align:justify;">int index = Convert.ToInt32(e.CommandArgument);</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// Retrieve the row that contains the button clicked</p>
<p style="text-align:justify;">// by the user from the Rows collection.</p>
<p style="text-align:justify;">GridViewRow row = ContactsGridView.Rows[index];</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// Create a new ListItem object for the contact in the row.</p>
<p style="text-align:justify;">ListItem item = new ListItem();</p>
<p style="text-align:justify;">item.Text = Server.HtmlDecode(row.Cells[2].Text) + &#8221; &#8221; +</p>
<p style="text-align:justify;">Server.HtmlDecode(row.Cells[3].Text);</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// If the contact is not already in the ListBox, add the ListItem</p>
<p style="text-align:justify;">// object to the Items collection of the ListBox control.</p>
<p style="text-align:justify;">if (!ContactsListBox.Items.Contains(item))</p>
<p style="text-align:justify;">{</p>
<p style="text-align:justify;">ContactsListBox.Items.Add(item);</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">&#60;/script&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;html  &#62;</p>
<p style="text-align:justify;">&#60;head runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;title&#62;GridView RowCommand Example&#60;/title&#62;</p>
<p style="text-align:justify;">&#60;/head&#62;</p>
<p style="text-align:justify;">&#60;body&#62;</p>
<p style="text-align:justify;">&#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;h3&#62;GridView RowCommand Example&#60;/h3&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;table width=&#8221;100%&#8221;&#62;</p>
<p style="text-align:justify;">&#60;tr&#62;</p>
<p style="text-align:justify;">&#60;td style=&#8221;width:50%&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;asp:gridview id=&#8221;ContactsGridView&#8221;</p>
<p style="text-align:justify;">datasourceid=&#8221;ContactsSource&#8221;</p>
<p style="text-align:justify;">allowpaging=&#8221;true&#8221;</p>
<p style="text-align:justify;">autogeneratecolumns=&#8221;false&#8221;</p>
<p style="text-align:justify;">onrowcommand=&#8221;ContactsGridView_RowCommand&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;columns&#62;</p>
<p style="text-align:justify;">&#60;asp:buttonfield buttontype=&#8221;Link&#8221;</p>
<p style="text-align:justify;">commandname=&#8221;Add&#8221;</p>
<p style="text-align:justify;">text=&#8221;Add&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;ContactID&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;Contact ID&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;FirstName&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;First Name&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;asp:boundfield datafield=&#8221;LastName&#8221;</p>
<p style="text-align:justify;">headertext=&#8221;Last Name&#8221;/&#62;</p>
<p style="text-align:justify;">&#60;/columns&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/asp:gridview&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/td&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;td style=&#8221;vertical-align:top; width:50%&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">Contacts: &#60;br/&#62;</p>
<p style="text-align:justify;">&#60;asp:listbox id=&#8221;ContactsListBox&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221; Height=&#8221;200px&#8221; Width=&#8221;200px&#8221;/&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/td&#62;</p>
<p style="text-align:justify;">&#60;/tr&#62;</p>
<p style="text-align:justify;">&#60;/table&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!&#8211; This example uses Microsoft SQL Server and connects    &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; to the AdventureWorks sample database. Use an ASP.NET  &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; expression to retrieve the connection string value     &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; from the Web.config file.                              &#8211;&#62;</p>
<p style="text-align:justify;">&#60;asp:sqldatasource id=&#8221;ContactsSource&#8221;</p>
<p style="text-align:justify;">selectcommand=&#8221;Select [ContactID], [FirstName], [LastName] From Person.Contact&#8221;</p>
<p style="text-align:justify;">connectionstring=&#8221;&#60;%$ ConnectionStrings:AdventureWorks_DataConnectionString%&#62;&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;/&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/form&#62;</p>
<p style="text-align:justify;">&#60;/body&#62;</p>
<p style="text-align:justify;">&#60;/html&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">The following example demonstrates how to use the <strong>RowCommand</strong> event to update the price of a product when a row&#8217;s button is clicked. This example has the paging functionality enabled for the GridView control and sets the CommandArgument property of the Button control to the appropriate row index.</p>
<p style="text-align:justify;">Visual Basic</p>
<p style="text-align:justify;">&#60;%@ Page language=&#8221;VB&#8221; %&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</p>
<p style="text-align:justify;">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62;</p>
<p style="text-align:justify;">&#60;script runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">
<p style="text-align:justify;">Sub ProductsGridView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; If multiple buttons are used in a GridView control, use the</p>
<p style="text-align:justify;">&#8216; CommandName property to determine which button was clicked.</p>
<p style="text-align:justify;">If e.CommandName = &#8220;Increase&#8221; Then</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Convert the row index stored in the CommandArgument</p>
<p style="text-align:justify;">&#8216; property to an Integer.</p>
<p style="text-align:justify;">Dim index = Convert.ToInt32(e.CommandArgument)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Retrieve the row that contains the button clicked</p>
<p style="text-align:justify;">&#8216; by the user from the Rows collection.</p>
<p style="text-align:justify;">Dim row = ProductsGridView.Rows(index)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Calculate the new price.</p>
<p style="text-align:justify;">Dim listPriceTextBox = CType(row.FindControl(&#8220;PriceLabel&#8221;), Label)</p>
<p style="text-align:justify;">listPriceTextBox.Text = (Convert.ToDouble(listPriceTextBox.Text) * 1.05).ToString()</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#8216; Update the row.</p>
<p style="text-align:justify;">ProductsGridView.UpdateRow(index, False)</p>
<p style="text-align:justify;">
<p style="text-align:justify;">End If</p>
<p style="text-align:justify;">
<p style="text-align:justify;">End Sub</p>
<p style="text-align:justify;">&#60;/script&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;html  &#62;</p>
<p style="text-align:justify;">&#60;head runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;title&#62;GridView RowCommand Example&#60;/title&#62;</p>
<p style="text-align:justify;">&#60;/head&#62;</p>
<p style="text-align:justify;">&#60;body&#62;</p>
<p style="text-align:justify;">&#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;h3&#62;GridView RowCommand Example&#60;/h3&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;asp:GridView id=&#8221;ProductsGridView&#8221;</p>
<p style="text-align:justify;">DataSourceID=&#8221;ProductsDataSource&#8221;</p>
<p style="text-align:justify;">DataKeyNames=&#8221;ProductID&#8221;</p>
<p style="text-align:justify;">AllowPaging=&#8221;True&#8221;</p>
<p style="text-align:justify;">OnRowCommand=&#8221;ProductsGridView_RowCommand&#8221;</p>
<p style="text-align:justify;">AutoGenerateColumns=&#8221;False&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;Columns&#62;</p>
<p style="text-align:justify;">&#60;asp:BoundField DataField=&#8221;Name&#8221; HeaderText=&#8221;Product Name&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;asp:BoundField DataField=&#8221;ProductNumber&#8221; HeaderText=&#8221;Product Number&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;asp:TemplateField HeaderText=&#8221;Price&#8221;&#62;</p>
<p style="text-align:justify;">&#60;ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;asp:Label ID=&#8221;PriceLabel&#8221; runat=&#8221;server&#8221;</p>
<p style="text-align:justify;">Text=&#8217;&#60;%# Bind(&#8220;ListPrice&#8221;) %&#62;&#8217;&#62;</p>
<p style="text-align:justify;">&#60;/asp:Label&#62;</p>
<p style="text-align:justify;">&#60;/ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;/asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;asp:Button runat=&#8221;server&#8221; ID=&#8221;IncreaseButton&#8221;</p>
<p style="text-align:justify;">Text=&#8221;Increase Price 5%&#8221;</p>
<p style="text-align:justify;">CommandName=&#8221;Increase&#8221;</p>
<p style="text-align:justify;">CommandArgument=&#8221;&#60;%# CType(Container, GridViewRow).RowIndex %&#62;&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;/ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;/asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;/Columns&#62;</p>
<p style="text-align:justify;">&#60;/asp:GridView&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!&#8211; This example uses Microsoft SQL Server and connects    &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; to the AdventureWorks sample database. Use an ASP.NET  &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; expression to retrieve the connection string value     &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; from the Web.config file.                              &#8211;&#62;</p>
<p style="text-align:justify;">&#60;asp:SqlDataSource id=&#8221;ProductsDataSource&#8221;</p>
<p style="text-align:justify;">SelectCommand=&#8221;SELECT [ProductID], [Name], [ProductNumber], [ListPrice]</p>
<p style="text-align:justify;">FROM Production.Product</p>
<p style="text-align:justify;">WHERE ListPrice &#38;lt;&#38;gt; 0&#8243;</p>
<p style="text-align:justify;">UpdateCommand=&#8221;UPDATE Production.Product SET [ListPrice] = @ListPrice</p>
<p style="text-align:justify;">WHERE [ProductID] = @ProductID&#8221;</p>
<p style="text-align:justify;">ConnectionString=&#8221;&#60;%$ ConnectionStrings:AdventureWorks_DataConnectionString %&#62;&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221; /&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;/form&#62;</p>
<p style="text-align:justify;">&#60;/body&#62;</p>
<p style="text-align:justify;">&#60;/html&#62;</p>
<p style="text-align:justify;">C#</p>
<p style="text-align:justify;">&#60;%@ Page language=&#8221;C#&#8221; %&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221;</p>
<p style="text-align:justify;">&#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&#62;</p>
<p style="text-align:justify;">&#60;script runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">void ProductsGridView_RowCommand(Object sender, GridViewCommandEventArgs e)</p>
<p style="text-align:justify;">{</p>
<p style="text-align:justify;">// If multiple buttons are used in a GridView control, use the</p>
<p style="text-align:justify;">// CommandName property to determine which button was clicked.</p>
<p style="text-align:justify;">if(e.CommandName==&#8221;Increase&#8221;)</p>
<p style="text-align:justify;">{</p>
<p style="text-align:justify;">// Convert the row index stored in the CommandArgument</p>
<p style="text-align:justify;">// property to an Integer.</p>
<p style="text-align:justify;">int index = Convert.ToInt32(e.CommandArgument);</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// Retrieve the row that contains the button clicked</p>
<p style="text-align:justify;">// by the user from the Rows collection.</p>
<p style="text-align:justify;">GridViewRow row = ProductsGridView.Rows[index];</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// Calculate the new price.</p>
<p style="text-align:justify;">Label listPriceTextBox = (Label)row.FindControl(&#8220;PriceLabel&#8221;);</p>
<p style="text-align:justify;">listPriceTextBox.Text = (Convert.ToDouble(listPriceTextBox.Text) * 1.05).ToString();</p>
<p style="text-align:justify;">
<p style="text-align:justify;">// Update the row.</p>
<p style="text-align:justify;">ProductsGridView.UpdateRow(index, false);</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">}</p>
<p style="text-align:justify;">&#60;/script&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;html  &#62;</p>
<p style="text-align:justify;">&#60;head runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;title&#62;GridView RowCommand Example&#60;/title&#62;</p>
<p style="text-align:justify;">&#60;/head&#62;</p>
<p style="text-align:justify;">&#60;body&#62;</p>
<p style="text-align:justify;">&#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;h3&#62;GridView RowCommand Example&#60;/h3&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;asp:GridView id=&#8221;ProductsGridView&#8221;</p>
<p style="text-align:justify;">DataSourceID=&#8221;ProductsDataSource&#8221;</p>
<p style="text-align:justify;">DataKeyNames=&#8221;ProductID&#8221;</p>
<p style="text-align:justify;">AllowPaging=&#8221;True&#8221;</p>
<p style="text-align:justify;">OnRowCommand=&#8221;ProductsGridView_RowCommand&#8221;</p>
<p style="text-align:justify;">AutoGenerateColumns=&#8221;False&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221;&#62;</p>
<p style="text-align:justify;">&#60;Columns&#62;</p>
<p style="text-align:justify;">&#60;asp:BoundField DataField=&#8221;Name&#8221; HeaderText=&#8221;Product Name&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;asp:BoundField DataField=&#8221;ProductNumber&#8221; HeaderText=&#8221;Product Number&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;asp:TemplateField HeaderText=&#8221;Price&#8221;&#62;</p>
<p style="text-align:justify;">&#60;ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;asp:Label ID=&#8221;PriceLabel&#8221; runat=&#8221;server&#8221;</p>
<p style="text-align:justify;">Text=&#8217;&#60;%# Bind(&#8220;ListPrice&#8221;) %&#62;&#8217;&#62;</p>
<p style="text-align:justify;">&#60;/asp:Label&#62;</p>
<p style="text-align:justify;">&#60;/ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;/asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;asp:Button runat=&#8221;server&#8221; ID=&#8221;IncreaseButton&#8221;</p>
<p style="text-align:justify;">Text=&#8221;Increase Price 5%&#8221;</p>
<p style="text-align:justify;">CommandName=&#8221;Increase&#8221;</p>
<p style="text-align:justify;">CommandArgument=&#8221;&#60;%# ((GridViewRow) Container).RowIndex %&#62;&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;/ItemTemplate&#62;</p>
<p style="text-align:justify;">&#60;/asp:TemplateField&#62;</p>
<p style="text-align:justify;">&#60;/Columns&#62;</p>
<p style="text-align:justify;">&#60;/asp:GridView&#62;</p>
<p style="text-align:justify;">
<p style="text-align:justify;">&#60;!&#8211; This example uses Microsoft SQL Server and connects    &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; to the AdventureWorks sample database. Use an ASP.NET  &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; expression to retrieve the connection string value     &#8211;&#62;</p>
<p style="text-align:justify;">&#60;!&#8211; from the Web.config file.                              &#8211;&#62;</p>
<p style="text-align:justify;">&#60;asp:SqlDataSource id=&#8221;ProductsDataSource&#8221;</p>
<p style="text-align:justify;">SelectCommand=&#8221;SELECT [ProductID], [Name], [ProductNumber], [ListPrice]</p>
<p style="text-align:justify;">FROM Production.Product</p>
<p style="text-align:justify;">WHERE ListPrice &#38;lt;&#38;gt; 0&#8243;</p>
<p style="text-align:justify;">UpdateCommand=&#8221;UPDATE Production.Product SET [ListPrice] = @ListPrice</p>
<p style="text-align:justify;">WHERE [ProductID] = @ProductID&#8221;</p>
<p style="text-align:justify;">ConnectionString=&#8221;&#60;%$ ConnectionStrings:AdventureWorks_DataConnectionString %&#62;&#8221;</p>
<p style="text-align:justify;">runat=&#8221;server&#8221; /&#62;</p>
<p style="text-align:justify;">&#60;/form&#62;</p>
<p style="text-align:justify;">&#60;/body&#62;</p>
<p style="text-align:justify;">&#60;/html&#62;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Uso del control WPF-ListView – Parte 1]]></title>
<link>http://zameb.wordpress.com/2009/11/08/uso-del-control-wpf-listview-%e2%80%93-parte-1/</link>
<pubDate>Sun, 08 Nov 2009 16:09:12 +0000</pubDate>
<dc:creator>zameb</dc:creator>
<guid>http://zameb.wordpress.com/2009/11/08/uso-del-control-wpf-listview-%e2%80%93-parte-1/</guid>
<description><![CDATA[En este artículo veremos como se crea la siguiente lista: &nbsp; &nbsp; Hay que empezar por olvidarn]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>En este artículo veremos como se crea la siguiente lista:</p>
<p>&#160;</p>
<p><img src="http://zameb.wordpress.com/files/2009/11/listview-gridview1.jpg" alt="listview-gridview" title="listview-gridview" width="463" height="237" class="alignnone size-full wp-image-69" /></p>
<p>&#160;</p>
<p>Hay que empezar por olvidarnos de mucho de lo que conocíamos del ListView de las versiones previas de Visual Studio. En primer lugar, no existe una colección de SubItems asociada a cada Item, tampoco tenemos las clásicas vistas para mostrar íconos grandes, medianos y pequeños o la clásica vista “Report”, para mostrar varias columnas. Estas son las dos primeras grandes diferencias que inicialmente saltan a la vista y que tendremos que aprender a sortear.</p>
<p>&#160;</p>
<p><strong>Agregar elementos</strong></p>
<p>La forma más sencilla de agregar Items, si se mantiene tal como la conocíamos y es la siguiente:</p>
<p>&#160;</p>
<pre class="brush: vb;">
        lstBooks.Items.Add(&#34;Pro WPF with VB 2008&#34;)
</pre>
<p>&#160;</p>
<p>De tal manera que es posible añadir cadenas para verlas directamente dentro de la lista.</p>
<p>Un poco más complicado resulta si queremos agregar elementos que luego se puedan mostrar en un listado multicolumna. Y es aquí donde no hará más falta utilizar la colección SubItems, ya que en su lugar, podemos agregar cualquier objeto personalizado a nuestra colección de Items, tal como se ve en el siguiente ejemplo:</p>
<p>&#160;</p>
<pre class="brush: vb;">
lstBooks.Items.Add(New bookBO(&#34;Coquito&#34;, &#34;Ediciones Bruño&#34;, 5))
</pre>
<p>&#160;</p>
<p>Lo que es lo mismo que:</p>
<p>&#160;</p>
<pre class="brush: vb;">
dim book as New bookBO()
book.Nombre = &#34;Coquito&#34;
book.Editor = &#34;Ediciones Bruño&#34;
book.Calificacion = 5
lstBooks.Items.Add(book)
</pre>
<p>&#160;</p>
<p>En ambos casos se ha agregado un Nuevo elemento del tipo bookBO (una clase personalizada).</p>
<p>&#160;</p>
<p><strong>Visualizar la lista</strong></p>
<p>Si en nuestro ListView sólo hemos agregado Strings, la visualización será inmediata; pero si es que hemos agregado elementos de una clase personalizada, tenemos dos alternativas: dotar a nuestra clase personaliza de una función ToString, que devuelva la cadena que deseamos que se muestre para cada fila de la lista; o, establecer adecuadamente la propiedad View.</p>
<p>&#160;</p>
<p>Aunque la propiedad View aún se mantiene, su funcionalidad es distinta. Ahora esta propiedad se utiliza para indicar un objeto del tipo GridView (el cual es configurable) o alguna clase personalizada que se derive de ViewBase.</p>
<p>&#160;</p>
<p>Si vamos a utilizar la clase GridView, podemos configurarla por código como se muestra en el siguiente ejemplo:</p>
<p>&#160;</p>
<pre class="brush: vb;">
        'Crear un objeto del tipo GridView
        Dim myGridView As New GridView()
        'Crear las columnas a agregar
        Dim gvc1 As New GridViewColumn()
        Dim gvc2 As New GridViewColumn()

        'Establecer las propiedades de cada columna
        gvc1.Header = &#34;Libro&#34;
        gvc1.Width = 140
        gvc1.DisplayMemberBinding = New Binding(&#34;NombreLibro&#34;)

        gvc2.Header = &#34;Autor&#34;
        gvc2.Width = 240
        gvc2.DisplayMemberBinding = New Binding(&#34;NombreAutor&#34;)

        'Agregar las columnas al objeto GridView
        myGridView.Columns.Add(gvc1)
        myGridView.Columns.Add(gvc2)

        'Establecer la vista del ListView
        lstBooks.View = myGridView
</pre>
<p>&#160;</p>
<p>Es importante notar la propiedad DisplayMemberBinding de cada columna. En esta propiedad se indica cual de las propiedades de nuestra clase personalizada corresponde a esa columna. Nuestra clase personalizada podría tener decenas de propiedades, pero de esta manera indicamos que sólo se muestren unas cuantas.</p>
<p>&#160;</p>
<p>Como alternativa, el código de ejemplo anterior, puede ser implementado en nuestro formulario de diseño por medio del siguiente código XAML:</p>
<p>&#160;</p>
<pre class="brush: xml;">
        &#60;ListView Name=&#34;lstBooks&#34; Margin=&#34;0,10,0,0&#34;&#62;
            &#60;ListView.View&#62;
                &#60;GridView&#62;
                    &#60;GridViewColumn Width=&#34;140&#34; Header=&#34;Libro&#34; DisplayMemberBinding=&#34;{Binding NombreLibro}&#34;  /&#62;
                    &#60;GridViewColumn Width=&#34;240&#34; Header=&#34;Autor&#34; DisplayMemberBinding=&#34;{Binding NombreAutor}&#34; /&#62;
                &#60;/GridView&#62;
            &#60;/ListView.View&#62;
        &#60;/ListView&#62;
</pre>
<p>&#160;</p>
<p><strong>Enlazar el ListView con una colección</strong></p>
<p>Es posible que la información ya la tengamos disponible en una colección. En tal caso no es necesario recorrerla para leer cada item y agregarlo al ListView, sino que podemos establecer la propiedad ItemsSource:</p>
<p>&#160;</p>
<pre class="brush: vb;">
	lstBooks.ItemsSource = MyCollection
</pre>
<p>&#160;</p>
<p>Esta posibilidad es especialmente efectiva si el objeto MyCollection es de la clase ObservableCollection, que para el ejemplo anterior se declara de la siguiente manera:</p>
<p>&#160;</p>
<pre class="brush: vb;">
	Dim MyCollection As ObservableCollection(Of bookBO)
</pre>
<p>&#160;</p>
<p>La ventaja de utilizar una clase ObservableCollection es que cualquier cambio que se realiza en la colección es automáticamente notificado y actualizado en la lista. De no ser así, nosotros mismos tendríamos que actualizar la lista cada vez que se modifique alguno de sus elementos (tal como lo hice en algún ejemplo del patrón MVC).</p>
<p>&#160;</p>
<p><strong>Ejemplo</strong></p>
<p>A continuación un ejemplo que resume algo de lo revisado en este artículo.</p>
<p>&#160;</p>
<p>XAML:</p>
<pre class="brush: xml;">
&#60;Page x:Class=&#34;ListViewSample3&#34;
    xmlns=&#34;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#34;
    xmlns:x=&#34;http://schemas.microsoft.com/winfx/2006/xaml&#34;
    Title=&#34;ListView1&#34; Background=&#34;CadetBlue&#34; Name=&#34;Page1&#34;&#62;
    &#60;Grid Height=&#34;268&#34; Width=&#34;591&#34;&#62;
        &#60;ListView Margin=&#34;73,50,0,0&#34; Name=&#34;lstBooks&#34; HorizontalAlignment=&#34;Left&#34; Width=&#34;429&#34; Height=&#34;196&#34; VerticalAlignment=&#34;Top&#34; /&#62;
    &#60;/Grid&#62;
&#60;/Page&#62;
</pre>
<p>&#160;</p>
<p>Código fuente del formulario:</p>
<pre class="brush: vb;">
Partial Public Class ListViewSample3

    Private Sub Page1_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        createTable()
        fillTable()
    End Sub

    Sub createTable()
        Dim myGridView As New GridView()
        Dim gvc1 As New GridViewColumn()
        Dim gvc2 As New GridViewColumn()

        gvc1.Header = &#34;Título&#34;
        myGridView.Columns.Add(gvc1)
        gvc1.Width = 200
        gvc1.DisplayMemberBinding = New Binding(&#34;Titulo&#34;)

        gvc2.Header = &#34;Autor&#34;
        myGridView.Columns.Add(gvc2)
        gvc2.Width = 200
        gvc2.DisplayMemberBinding = New Binding(&#34;Autor&#34;)

        lstBooks.View = myGridView
    End Sub

    Sub fillTable()
        lstBooks.Items.Clear()

        lstBooks.Items.Add(New bookBO(&#34;Windows Presentation Foundation Unleashed&#34;, &#34;Adam N&#34;))
        lstBooks.Items.Add(New bookBO(&#34;Pro WPF with VB 2008&#34;, &#34;Matthew McD&#34;))
        lstBooks.Items.Add(New bookBO(&#34;3D Programming-for-windows by WPF&#34;, &#34;Charles P&#34;))
    End Sub

End Class
</pre>
<p>&#160;</p>
<p>Clase BookBO:</p>
<pre class="brush: vb;">
Public Class bookBO

Public Class bookBO
    Private mTitulo As String
    Private mAutor As String

    Public Sub New(ByVal Titulo As String, ByVal Autor As String)
        mTitulo = Titulo
        mAutor = Autor
    End Sub

    Public Property Titulo() As String
        Get
            Titulo = mTitulo
        End Get
        Set(ByVal value As String)
            mTitulo = value
        End Set
    End Property

    Public Property Autor() As String
        Get
            Autor = mAutor
        End Get
        Set(ByVal value As String)
            mAutor = value
        End Set
    End Property

    'Esta funcion no es necesaria, solo para mostrar su implementacion
    Public Overrides Function ToString() As String
        ToString = mTitulo + &#34; - &#34; + mAutor
    End Function
End Class
</pre>
<p>&#160;</p>
<p>&#160;</p>
<p>Resultado<br />
<img src="http://zameb.wordpress.com/files/2009/11/listview-gridview1.jpg" alt="listview-gridview" title="listview-gridview" width="463" height="237" class="alignnone size-full wp-image-69" /></p>
<p>&#160;</p>
<p>En el próximo artículo revisaremos como agregar controles (gráficos incluidos) dentro de un ListView y mantenerlos enlazados con nuestra clase personalizada.</p>
<p>&#160;</p>
<p>Hasta pronto!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Generic editable GridView - ASP.NET MVC]]></title>
<link>http://minalabib.wordpress.com/2009/11/07/generic-editable-gridview-asp-net-mvc/</link>
<pubDate>Sat, 07 Nov 2009 06:13:54 +0000</pubDate>
<dc:creator>Mina  Labib</dc:creator>
<guid>http://minalabib.wordpress.com/2009/11/07/generic-editable-gridview-asp-net-mvc/</guid>
<description><![CDATA[The goal is to build editable data grid in a project uses ASP.NET MVC 1.0, it is know that ASP.NET M]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>The goal is to build editable data grid in a project uses ASP.NET MVC 1.0, it is know that ASP.NET MVC does not use controls with ( runat=”server” ) attribute, which means I can’t use regular DataGrid or GridView in my code. and <a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.htmlhelper.aspx" target="_blank">HTMLHelper</a> class in ASP.NET MVC does provide such HTML component.</p>
<p>So, there are two solutions:</p>
<p><!--more--></p>
<ol>
<li>Using extension to extend HTMLHelper functionality and build HTML using code
<div id="codeSnippetWrapper" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;cursor:text;border:silver 1px solid;margin:20px 0 10px;padding:4px;">
<div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">class</span> GridViewExt</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> GridView(<span style="color:#0000ff;">this</span> HtmlHelper html, IEnumerable DataSource, <span style="color:#0000ff;">object</span> HTMLAtrributes)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum5" style="color:#606060;">   5:</span>             <span style="color:#0000ff;">string</span> htmlAttributesString = ConvertToAtrributes.ConvertObjectToAttributeList(HTMLAtrributes).Trim();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum6" style="color:#606060;">   6:</span>             StringBuilder resultBuilder = <span style="color:#0000ff;">new</span> StringBuilder();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum7" style="color:#606060;">   7:</span>             resultBuilder.AppendFormat(<span style="color:#006080;">"&#60;table{0}{1}&#62;"</span>, <span style="color:#0000ff;">string</span>.IsNullOrEmpty(htmlAttributesString) ? <span style="color:#006080;">""</span> : <span style="color:#006080;">" "</span>, htmlAttributesString).AppendLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum8" style="color:#606060;">   8:</span>             IEnumerator sourceEnumerator = DataSource.GetEnumerator();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum9" style="color:#606060;">   9:</span>             Type itemType;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum10" style="color:#606060;">  10:</span>             <span style="color:#0000ff;">if</span> (sourceEnumerator.MoveNext() == <span style="color:#0000ff;">false</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum11" style="color:#606060;">  11:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum12" style="color:#606060;">  12:</span>                 <span style="color:#0000ff;">return</span> <span style="color:#006080;">""</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum13" style="color:#606060;">  13:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum14" style="color:#606060;">  14:</span>             <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum15" style="color:#606060;">  15:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum16" style="color:#606060;">  16:</span>                 itemType = sourceEnumerator.Current.GetType();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum17" style="color:#606060;">  17:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum18" style="color:#606060;">  18:</span>             PropertyInfo[] properties = itemType.GetProperties();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum19" style="color:#606060;">  19:</span>             resultBuilder.AppendLine(<span style="color:#006080;">"\t&#60;tr&#62;"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum20" style="color:#606060;">  20:</span>             <span style="color:#0000ff;">foreach</span> (PropertyInfo property <span style="color:#0000ff;">in</span> properties)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum21" style="color:#606060;">  21:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum22" style="color:#606060;">  22:</span>                 resultBuilder.AppendFormat(<span style="color:#006080;">"\t\t&#60;th&#62;{0}&#60;/th&#62;"</span>, property.Name).AppendLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum23" style="color:#606060;">  23:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum24" style="color:#606060;">  24:</span>             resultBuilder.AppendLine(<span style="color:#006080;">"\t&#60;/tr&#62;"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum25" style="color:#606060;">  25:</span>             <span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">object</span> item <span style="color:#0000ff;">in</span> DataSource)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum26" style="color:#606060;">  26:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum27" style="color:#606060;">  27:</span>                 resultBuilder.AppendLine(<span style="color:#006080;">"\t&#60;tr&#62;"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum28" style="color:#606060;">  28:</span>                 <span style="color:#0000ff;">foreach</span> (PropertyInfo property <span style="color:#0000ff;">in</span> properties)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum29" style="color:#606060;">  29:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum30" style="color:#606060;">  30:</span>                     resultBuilder.AppendFormat(<span style="color:#006080;">"\t\t&#60;td&#62;{0}&#60;/td&#62;"</span>, property.GetValue(item, <span style="color:#0000ff;">null</span>)).AppendLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum31" style="color:#606060;">  31:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum32" style="color:#606060;">  32:</span>                 resultBuilder.AppendLine(<span style="color:#006080;">"\t&#60;/tr&#62;"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum33" style="color:#606060;">  33:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum34" style="color:#606060;">  34:</span>             resultBuilder.Append(<span style="color:#006080;">"&#60;/table&#62;"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum35" style="color:#606060;">  35:</span>             <span style="color:#0000ff;">return</span> resultBuilder.ToString();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum36" style="color:#606060;">  36:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum37" style="color:#606060;">  37:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum38" style="color:#606060;">  38:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> ConvertToAtrributes</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum39" style="color:#606060;">  39:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum40" style="color:#606060;">  40:</span>         <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">static</span> <span style="color:#0000ff;">string</span> ConvertObjectToAttributeList(<span style="color:#0000ff;">object</span> <span style="color:#0000ff;">value</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum41" style="color:#606060;">  41:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum42" style="color:#606060;">  42:</span>             StringBuilder builder = <span style="color:#0000ff;">new</span> StringBuilder();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum43" style="color:#606060;">  43:</span>             <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">value</span> != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum44" style="color:#606060;">  44:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum45" style="color:#606060;">  45:</span>                 IDictionary&#60;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&#62; dictionary = <span style="color:#0000ff;">value</span> <span style="color:#0000ff;">as</span> IDictionary&#60;<span style="color:#0000ff;">string</span>, <span style="color:#0000ff;">object</span>&#62;;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum46" style="color:#606060;">  46:</span>                 <span style="color:#0000ff;">if</span> (dictionary == <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum47" style="color:#606060;">  47:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum48" style="color:#606060;">  48:</span>                     dictionary = <span style="color:#0000ff;">new</span> RouteValueDictionary(<span style="color:#0000ff;">value</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum49" style="color:#606060;">  49:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum50" style="color:#606060;">  50:</span>                 <span style="color:#0000ff;">string</span> format = <span style="color:#006080;">"{0}=\"{1}\" "</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum51" style="color:#606060;">  51:</span>                 <span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">string</span> str2 <span style="color:#0000ff;">in</span> dictionary.Keys)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum52" style="color:#606060;">  52:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum53" style="color:#606060;">  53:</span>                     <span style="color:#0000ff;">object</span> obj2 = dictionary[str2];</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum54" style="color:#606060;">  54:</span>                     <span style="color:#0000ff;">if</span> (dictionary[str2] <span style="color:#0000ff;">is</span> <span style="color:#0000ff;">bool</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum55" style="color:#606060;">  55:</span>                     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum56" style="color:#606060;">  56:</span>                         obj2 = dictionary[str2].ToString().ToLowerInvariant();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum57" style="color:#606060;">  57:</span>                     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum58" style="color:#606060;">  58:</span>                     builder.AppendFormat(format, str2.Replace(<span style="color:#006080;">"_"</span>, <span style="color:#006080;">""</span>).ToLowerInvariant(), obj2);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum59" style="color:#606060;">  59:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum60" style="color:#606060;">  60:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum61" style="color:#606060;">  61:</span>             <span style="color:#0000ff;">return</span> builder.ToString();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum62" style="color:#606060;">  62:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum63" style="color:#606060;">  63:</span>     }</pre>
<p><!--CRLF--></p>
</div>
</div>
<p>now you should be able to call to call HTMLHelper extended method inside your View</p>
<pre style="background-color:#fbfbfb;min-height:40px;width:393px;height:52px;overflow:auto;border:#cecece 1px solid;padding:5px;">
<pre style="background-color:#e0e0e0;width:100%;font-family:consolas,'Courier New',courier,monospace;font-size:10px;margin:0;">  1: <span style="background-color:#ffff00;color:black;">&#60;%</span>= this.Html.GridView(Model.Products)<span style="background-color:#ffff00;color:black;">%&#62;</span></pre>
</pre>
<p>but it is still not editable and to add editing functionality it will be so hard to write a lot of HTML code inside C# code and will not be easy to maintain or fix issues; so let’s consider the second option.</li>
<li>Building User control and get advantage of writing HTML inside the user control HTML (one thing to remember using ASP.NET MVC no use for page life cycle you can get rid of that).
<p>Now let me build a user control ascx page using fantastic <a href="http://www.jquery.com" target="_blank">JQuery</a> fetures</p>
<div id="codeSnippetWrapper" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;cursor:text;border:silver 1px solid;margin:20px 0 10px;padding:4px;">
<div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> <span style="background-color:#ffff00;">&#60;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="GridView.ascx.cs" Inherits="Shared.UserControls.GridView" %&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span> <span style="background-color:#ffff00;">&#60;%@ Import Namespace="System.Reflection" %&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span> <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- style code --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span> <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">style</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text/css"</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum5" style="color:#606060;">   5:</span>     .gridView</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum6" style="color:#606060;">   6:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum7" style="color:#606060;">   7:</span>         border-collapse: collapse;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum8" style="color:#606060;">   8:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum9" style="color:#606060;">   9:</span>     .gridView th, .gridView td</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum10" style="color:#606060;">  10:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum11" style="color:#606060;">  11:</span>         padding: 5px;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum12" style="color:#606060;">  12:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum13" style="color:#606060;">  13:</span>     .gridView th</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum14" style="color:#606060;">  14:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum15" style="color:#606060;">  15:</span>         border-bottom: double 3px black;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum16" style="color:#606060;">  16:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum17" style="color:#606060;">  17:</span>     .gridView td</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum18" style="color:#606060;">  18:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum19" style="color:#606060;">  19:</span>         border-bottom: solid 1px black;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum20" style="color:#606060;">  20:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum21" style="color:#606060;">  21:</span>     .alternatingItem</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum22" style="color:#606060;">  22:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum23" style="color:#606060;">  23:</span>         background-color: lightgrey;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum24" style="color:#606060;">  24:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum25" style="color:#606060;">  25:</span> <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">style</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum26" style="color:#606060;">  26:</span> <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Javascripts code --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum27" style="color:#606060;">  27:</span> <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">script</span> <span style="color:#ff0000;">src</span><span style="color:#0000ff;">="../../Scripts/jquery-1.3.2.js"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text/javascript"</span><span style="color:#0000ff;">&#62;&#60;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&#62;</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span> &#60;%--&#60;script src=<span style="color:#006080;">"../../Scripts/jquery-1.3.2-vsdoc.js"</span> type=<span style="color:#006080;">"text/javascript"</span>&#62;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> &#60;/script&#62;--%&#62;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span> &#60;script type=<span style="color:#006080;">"text/javascript"</span>&#62;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span>     <span style="color:#0000ff;">var</span> controller = <span style="color:#006080;">''</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span>     <span style="color:#0000ff;">var</span> SaveAction = <span style="color:#006080;">''</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum5" style="color:#606060;">   5:</span>     &#60;% GetController(); GetSaveAction(); %&#62;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum6" style="color:#606060;">   6:</span>     <span style="color:#0000ff;">function</span> IsValidAction(ctrl, actn)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum7" style="color:#606060;">   7:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum8" style="color:#606060;">   8:</span>         <span style="color:#0000ff;">if</span>(($.trim(ctrl) == <span style="color:#006080;">''</span>) &#124;&#124; ($.trim(actn) == <span style="color:#006080;">''</span>))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum9" style="color:#606060;">   9:</span>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum10" style="color:#606060;">  10:</span>         <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum11" style="color:#606060;">  11:</span>             <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum12" style="color:#606060;">  12:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum13" style="color:#606060;">  13:</span>     <span style="color:#0000ff;">function</span> SaveAllClick() {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum14" style="color:#606060;">  14:</span>         <span style="color:#008000;">//debugger;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum15" style="color:#606060;">  15:</span>         <span style="color:#0000ff;">if</span>(!IsValidAction(controller,SaveAction))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum16" style="color:#606060;">  16:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum17" style="color:#606060;">  17:</span>             alert(<span style="color:#006080;">"Error while saving data"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum18" style="color:#606060;">  18:</span>             <span style="color:#0000ff;">return</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum19" style="color:#606060;">  19:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum20" style="color:#606060;">  20:</span>         <span style="color:#0000ff;">var</span> i = 0;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum21" style="color:#606060;">  21:</span>         <span style="color:#0000ff;">var</span> inputs = <span style="color:#0000ff;">new</span> Array();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum22" style="color:#606060;">  22:</span>         $(<span style="color:#006080;">"#BaseTable"</span>).find(<span style="color:#006080;">"input"</span>).each(<span style="color:#0000ff;">function</span>() {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum23" style="color:#606060;">  23:</span>             inputs[i] = [<span style="color:#0000ff;">this</span>.id, <span style="color:#0000ff;">this</span>.value];</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum24" style="color:#606060;">  24:</span>             i++;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum25" style="color:#606060;">  25:</span>         });</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum26" style="color:#606060;">  26:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum27" style="color:#606060;">  27:</span>         <span style="color:#0000ff;">var</span> columnsCount = $(<span style="color:#006080;">"#BaseTable"</span>).find(<span style="color:#006080;">"th"</span>).length;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum28" style="color:#606060;">  28:</span>         $.post(<span style="color:#006080;">"/"</span>+controller+<span style="color:#006080;">"/"</span>+SaveAction, { inputs: inputs, columnsCount: columnsCount });</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum29" style="color:#606060;">  29:</span>         Border();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum30" style="color:#606060;">  30:</span>         $(<span style="color:#006080;">"#ChangeFlag"</span>).text(<span style="color:#006080;">""</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum31" style="color:#606060;">  31:</span>         $(<span style="color:#006080;">"#SaveAll"</span>).attr(<span style="color:#006080;">"disabled"</span>, <span style="color:#006080;">"disabled"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum32" style="color:#606060;">  32:</span>         alert(<span style="color:#006080;">"Saved"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum33" style="color:#606060;">  33:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum34" style="color:#606060;">  34:</span>     <span style="color:#0000ff;">var</span> prevCell;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum35" style="color:#606060;">  35:</span>     <span style="color:#0000ff;">function</span> Border(cell) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum36" style="color:#606060;">  36:</span>         <span style="color:#0000ff;">if</span> (prevCell != <span style="color:#0000ff;">null</span>) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum37" style="color:#606060;">  37:</span>             $(prevCell).attr(<span style="color:#006080;">"style"</span>, <span style="color:#006080;">"border-style: none"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum38" style="color:#606060;">  38:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum39" style="color:#606060;">  39:</span>         <span style="color:#0000ff;">if</span> (cell != <span style="color:#0000ff;">null</span>) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum40" style="color:#606060;">  40:</span>             <span style="color:#0000ff;">var</span> i = $(cell); <span style="color:#008000;">//.find("input");</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum41" style="color:#606060;">  41:</span>             i.attr(<span style="color:#006080;">"style"</span>, <span style="color:#006080;">"border-style: inset"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum42" style="color:#606060;">  42:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum43" style="color:#606060;">  43:</span>         prevCell = cell;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum44" style="color:#606060;">  44:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum45" style="color:#606060;">  45:</span>     <span style="color:#0000ff;">function</span> Unborder(cell) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum46" style="color:#606060;">  46:</span>         <span style="color:#0000ff;">if</span> (cell != <span style="color:#0000ff;">null</span>) {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum47" style="color:#606060;">  47:</span>             <span style="color:#0000ff;">var</span> i = $(cell); <span style="color:#008000;">//.find("input");</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum48" style="color:#606060;">  48:</span>             i.attr(<span style="color:#006080;">"style"</span>, <span style="color:#006080;">"border-style: none"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum49" style="color:#606060;">  49:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum50" style="color:#606060;">  50:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum51" style="color:#606060;">  51:</span>     <span style="color:#0000ff;">function</span> MarkChanges() {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum52" style="color:#606060;">  52:</span>         $(<span style="color:#006080;">"#ChangeFlag"</span>).text(<span style="color:#006080;">"Page should be saved"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum53" style="color:#606060;">  53:</span>         $(<span style="color:#006080;">"#SaveAll"</span>).removeAttr(<span style="color:#006080;">"disabled"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum54" style="color:#606060;">  54:</span>     }</pre>
<p><!--CRLF--><span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum28" style="color:#606060;">  28:</span> <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Show the Headers --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum29" style="color:#606060;">  29:</span> <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">table</span> <span style="color:#ff0000;">class</span><span style="color:#0000ff;">="gridView"</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="BaseTable"</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum30" style="color:#606060;">  30:</span>     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">thead</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum31" style="color:#606060;">  31:</span>         <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">tr</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum32" style="color:#606060;">  32:</span>             <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">foreach</span> (PropertyInfo prop <span style="color:#0000ff;">in</span> <span style="color:#0000ff;">this</span>.Columns)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum33" style="color:#606060;">  33:</span>             <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">th</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum34" style="color:#606060;">  34:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> = prop.Name</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum35" style="color:#606060;">  35:</span>             <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">th</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum36" style="color:#606060;">  36:</span>             <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum37" style="color:#606060;">  37:</span>         <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">tr</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum38" style="color:#606060;">  38:</span>     <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">thead</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum39" style="color:#606060;">  39:</span>     <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Show the Rows --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum40" style="color:#606060;">  40:</span>     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">tbody</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum41" style="color:#606060;">  41:</span>         <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">foreach</span> (<span style="color:#0000ff;">object</span> row <span style="color:#0000ff;">in</span> <span style="color:#0000ff;">this</span>.Rows)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>            {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum42" style="color:#606060;">  42:</span>         <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">tr</span> <span style="color:#ff0000;">class</span><span style="color:#0000ff;">="&#60;%= this.FlipCssClass( "</span><span style="color:#ff0000;">item</span><span style="color:#0000ff;">", "</span><span style="color:#ff0000;">alternatingItem</span><span style="color:#0000ff;">") %&#62;"</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum43" style="color:#606060;">  43:</span>             <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Show Each Column --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum44" style="color:#606060;">  44:</span>             <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">foreach</span> (PropertyInfo prop <span style="color:#0000ff;">in</span> <span style="color:#0000ff;">this</span>.Columns)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum45" style="color:#606060;">  45:</span>             <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">td</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum46" style="color:#606060;">  46:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  var typeCode = Type.GetTypeCode(prop.PropertyType);</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum47" style="color:#606060;">  47:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> var str_disabled = <span style="color:#006080;">""</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                   <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">this</span>.GetAtt(prop.Name))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span>                       str_disabled = <span style="color:#006080;">"disabled=\"disabled\""</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span></pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum48" style="color:#606060;">  48:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- String Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum49" style="color:#606060;">  49:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.String)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum50" style="color:#606060;">  50:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="&#60;%=prop.Name %&#62;"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="border-style: none"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="&#60;%= GetColumnValue(row, prop.Name)%&#62;"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum51" style="color:#606060;">  51:</span>                     <span style="color:#ff0000;">onmousedown</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onselect</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onblur</span><span style="color:#0000ff;">="Unborder(this)"</span> <span style="color:#ff0000;">onchange</span><span style="color:#0000ff;">="MarkChanges()"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum52" style="color:#606060;">  52:</span>                     &#38;<span style="color:#ff0000;">lt</span>;%= <span style="color:#ff0000;">str_disabled</span> %&#38;<span style="color:#ff0000;">gt</span>; <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum53" style="color:#606060;">  53:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum54" style="color:#606060;">  54:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- DateTime Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum55" style="color:#606060;">  55:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.DateTime)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum56" style="color:#606060;">  56:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="&#60;%=prop.Name %&#62;"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="border-style: none"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="&#60;%= GetColumnValue(row, prop.Name, "</span>{<span style="color:#ff0000;">0:D</span>}<span style="color:#0000ff;">")%&#62;"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum57" style="color:#606060;">  57:</span>                     <span style="color:#ff0000;">onmousedown</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onselect</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onblur</span><span style="color:#0000ff;">="Unborder(this)"</span> <span style="color:#ff0000;">onchange</span><span style="color:#0000ff;">="MarkChanges()"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum58" style="color:#606060;">  58:</span>                     &#38;<span style="color:#ff0000;">lt</span>;%= <span style="color:#ff0000;">str_disabled</span> %&#38;<span style="color:#ff0000;">gt</span>; <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum59" style="color:#606060;">  59:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum60" style="color:#606060;">  60:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Decimal Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum61" style="color:#606060;">  61:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.Decimal)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum62" style="color:#606060;">  62:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="&#60;%=prop.Name %&#62;"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="border-style: none"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="&#60;%= GetColumnValue(row, prop.Name, "</span>{<span style="color:#ff0000;">0:f</span>}<span style="color:#0000ff;">") %&#62;"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum63" style="color:#606060;">  63:</span>                     <span style="color:#ff0000;">onmousedown</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onselect</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onblur</span><span style="color:#0000ff;">="Unborder(this)"</span> <span style="color:#ff0000;">onchange</span><span style="color:#0000ff;">="MarkChanges()"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum64" style="color:#606060;">  64:</span>                     &#38;<span style="color:#ff0000;">lt</span>;%= <span style="color:#ff0000;">str_disabled</span> %&#38;<span style="color:#ff0000;">gt</span>; <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum65" style="color:#606060;">  65:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum66" style="color:#606060;">  66:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Decimal Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum67" style="color:#606060;">  67:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.Double)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span>$</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum68" style="color:#606060;">  68:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="&#60;%=prop.Name %&#62;"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="border-style: none"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="&#60;%= GetColumnValue(row, prop.Name, "</span>{<span style="color:#ff0000;">0:f</span>}<span style="color:#0000ff;">") %&#62;"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum69" style="color:#606060;">  69:</span>                     <span style="color:#ff0000;">onmousedown</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onselect</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onblur</span><span style="color:#0000ff;">="Unborder(this)"</span> <span style="color:#ff0000;">onchange</span><span style="color:#0000ff;">="MarkChanges()"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum70" style="color:#606060;">  70:</span>                     &#38;<span style="color:#ff0000;">lt</span>;%= <span style="color:#ff0000;">str_disabled</span> %&#38;<span style="color:#ff0000;">gt</span>; <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum71" style="color:#606060;">  71:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum72" style="color:#606060;">  72:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Boolean Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum73" style="color:#606060;">  73:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.Boolean)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum74" style="color:#606060;">  74:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> ((<span style="color:#0000ff;">bool</span>)(<span style="color:#0000ff;">this</span>.GetColumnValue(row, prop.Name)))</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum75" style="color:#606060;">  75:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="checkbox"</span> <span style="color:#ff0000;">disabled</span><span style="color:#0000ff;">="disabled"</span> <span style="color:#ff0000;">checked</span><span style="color:#0000ff;">="checked"</span> <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum76" style="color:#606060;">  76:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum77" style="color:#606060;">  77:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="checkbox"</span> <span style="color:#ff0000;">disabled</span><span style="color:#0000ff;">="disabled"</span> <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum78" style="color:#606060;">  78:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum79" style="color:#606060;">  79:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum80" style="color:#606060;">  80:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> -- Integer Columns --</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum81" style="color:#606060;">  81:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  <span style="color:#0000ff;">if</span> (typeCode == TypeCode.Int32)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>                    {</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum82" style="color:#606060;">  82:</span>                 <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="&#60;%=prop.Name %&#62;"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="border-style: none"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="&#60;%= GetColumnValue(row, prop.Name)%&#62;"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum83" style="color:#606060;">  83:</span>                     <span style="color:#ff0000;">onmousedown</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onselect</span><span style="color:#0000ff;">="Border(this)"</span> <span style="color:#ff0000;">onblur</span><span style="color:#0000ff;">="Unborder(this)"</span> <span style="color:#ff0000;">onchange</span><span style="color:#0000ff;">="MarkChanges()"</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum84" style="color:#606060;">  84:</span>                     &#38;<span style="color:#ff0000;">lt</span>;%= <span style="color:#ff0000;">str_disabled</span> %&#38;<span style="color:#ff0000;">gt</span>; <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum85" style="color:#606060;">  85:</span>                 <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum86" style="color:#606060;">  86:</span>             <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">td</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum87" style="color:#606060;">  87:</span>             <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum88" style="color:#606060;">  88:</span>         <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">tr</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum89" style="color:#606060;">  89:</span>         <span style="background-color:#ffff00;">&#60;%</span>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span>  }</pre>
<p><!--CRLF--><span style="background-color:#ffff00;">%&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum90" style="color:#606060;">  90:</span>     <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">tbody</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum91" style="color:#606060;">  91:</span> <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">table</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum92" style="color:#606060;">  92:</span> <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">p</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum93" style="color:#606060;">  93:</span>     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">input</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="SaveAll"</span> <span style="color:#ff0000;">disabled</span><span style="color:#0000ff;">="disabled"</span> <span style="color:#ff0000;">type</span><span style="color:#0000ff;">="button"</span> <span style="color:#ff0000;">value</span><span style="color:#0000ff;">="Save"</span> <span style="color:#ff0000;">onclick</span><span style="color:#0000ff;">="SaveAllClick()"</span> <span style="color:#0000ff;">/&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum94" style="color:#606060;">  94:</span>     <span style="color:#0000ff;">&#60;</span><span style="color:#800000;">span</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="ChangeFlag"</span><span style="color:#0000ff;">&#62;&#60;/</span><span style="color:#800000;">span</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum95" style="color:#606060;">  95:</span> <span style="color:#0000ff;">&#60;/</span><span style="color:#800000;">p</span><span style="color:#0000ff;">&#62;</span></pre>
<p><!--CRLF--></p>
</div>
</div>
<p>and building code behind code for this user control using <a href="http://aspxwizard.net/blogs/minalabib/archive/2009/11/06/run-time-dynamic-attributes-in-c.aspx" target="_blank">last post</a> idea of TypeDescriptor class to make the user control more generic accepting any type of collection and render editable properties according to custom attributes associated with it.</p>
<div id="codeSnippetWrapper" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:'Courier New', courier, monospace;direction:ltr;max-height:200px;font-size:8pt;overflow:auto;cursor:text;border:silver 1px solid;margin:20px 0 10px;padding:4px;">
<div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> <span style="color:#0000ff;">using</span> System;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span> <span style="color:#0000ff;">using</span> System.Collections;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span> <span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span> <span style="color:#0000ff;">using</span> System.Linq;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum5" style="color:#606060;">   5:</span> <span style="color:#0000ff;">using</span> System.Web;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum6" style="color:#606060;">   6:</span> <span style="color:#0000ff;">using</span> System.Web.UI;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum7" style="color:#606060;">   7:</span> <span style="color:#0000ff;">using</span> System.Web.Mvc;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum8" style="color:#606060;">   8:</span> <span style="color:#0000ff;">using</span> System.Reflection;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum9" style="color:#606060;">   9:</span> <span style="color:#0000ff;">using</span> System.ComponentModel;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum10" style="color:#606060;">  10:</span> <span style="color:#0000ff;">using</span> CustomAtrributes;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum11" style="color:#606060;">  11:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum12" style="color:#606060;">  12:</span> <span style="color:#0000ff;">namespace</span> Shared.UserControls</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum13" style="color:#606060;">  13:</span> {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum14" style="color:#606060;">  14:</span>     <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> GridView : System.Web.Mvc.ViewUserControl&#60;IEnumerable&#62;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum15" style="color:#606060;">  15:</span>     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum16" style="color:#606060;">  16:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">string</span> GetController()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum17" style="color:#606060;">  17:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum18" style="color:#606060;">  18:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum19" style="color:#606060;">  19:</span>             <span style="color:#0000ff;">if</span> (ViewContext.RouteData.Values[<span style="color:#006080;">"Controller"</span>] != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum20" style="color:#606060;">  20:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum21" style="color:#606060;">  21:</span>                 Response.Write(<span style="color:#006080;">"controller = '"</span> + ViewContext.RouteData.Values[<span style="color:#006080;">"Controller"</span>] <span style="color:#0000ff;">as</span> <span style="color:#0000ff;">string</span> + <span style="color:#006080;">"';"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum22" style="color:#606060;">  22:</span>                 <span style="color:#0000ff;">return</span> ViewContext.RouteData.Values[<span style="color:#006080;">"Controller"</span>] <span style="color:#0000ff;">as</span> <span style="color:#0000ff;">string</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum23" style="color:#606060;">  23:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum24" style="color:#606060;">  24:</span>             <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum25" style="color:#606060;">  25:</span>                 <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">string</span>.Empty;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum26" style="color:#606060;">  26:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum27" style="color:#606060;">  27:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">string</span> GetSaveAction()</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum28" style="color:#606060;">  28:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum29" style="color:#606060;">  29:</span>             <span style="color:#0000ff;">if</span> (ViewData.Model.GetType().GetProperty(<span style="color:#006080;">"SaveAction"</span>) != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum30" style="color:#606060;">  30:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum31" style="color:#606060;">  31:</span>                 Response.Write(<span style="color:#006080;">"SaveAction = '"</span> + DataBinder.Eval(ViewData.Model, <span style="color:#006080;">"SaveAction"</span>) <span style="color:#0000ff;">as</span> <span style="color:#0000ff;">string</span> + <span style="color:#006080;">"';"</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum32" style="color:#606060;">  32:</span>                 <span style="color:#0000ff;">return</span> DataBinder.Eval(ViewData.Model, <span style="color:#006080;">"SaveAction"</span>) <span style="color:#0000ff;">as</span> <span style="color:#0000ff;">string</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum33" style="color:#606060;">  33:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum34" style="color:#606060;">  34:</span>             <span style="color:#0000ff;">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum35" style="color:#606060;">  35:</span>                 <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">string</span>.Empty;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum36" style="color:#606060;">  36:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum37" style="color:#606060;">  37:</span>         <span style="color:#0000ff;">protected</span> PropertyInfo[] Columns</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum38" style="color:#606060;">  38:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum39" style="color:#606060;">  39:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum40" style="color:#606060;">  40:</span>             get</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum41" style="color:#606060;">  41:</span>             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum42" style="color:#606060;">  42:</span>                 var e = ViewData.Model.GetEnumerator();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum43" style="color:#606060;">  43:</span>                 e.MoveNext();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum44" style="color:#606060;">  44:</span>                 <span style="color:#0000ff;">object</span> firstRow = e.Current;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum45" style="color:#606060;">  45:</span>                 <span style="color:#0000ff;">if</span> (firstRow == <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum46" style="color:#606060;">  46:</span>                 {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum47" style="color:#606060;">  47:</span>                     <span style="color:#0000ff;">throw</span> <span style="color:#0000ff;">new</span> Exception(<span style="color:#006080;">"No data passed to GridView User Control."</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum48" style="color:#606060;">  48:</span>                 }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum49" style="color:#606060;">  49:</span>                 <span style="color:#0000ff;">return</span> firstRow.GetType().GetProperties();</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum50" style="color:#606060;">  50:</span>             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum51" style="color:#606060;">  51:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum52" style="color:#606060;">  52:</span>         <span style="color:#0000ff;">protected</span> IEnumerable Rows</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum53" style="color:#606060;">  53:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum54" style="color:#606060;">  54:</span>             get { <span style="color:#0000ff;">return</span> ViewData.Model; }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum55" style="color:#606060;">  55:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum56" style="color:#606060;">  56:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">object</span> GetColumnValue(<span style="color:#0000ff;">object</span> row, <span style="color:#0000ff;">string</span> columnName)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum57" style="color:#606060;">  57:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum58" style="color:#606060;">  58:</span>             <span style="color:#0000ff;">return</span> DataBinder.Eval(row, columnName);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum59" style="color:#606060;">  59:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum60" style="color:#606060;">  60:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">object</span> GetColumnValue(<span style="color:#0000ff;">object</span> row, <span style="color:#0000ff;">string</span> columnName, <span style="color:#0000ff;">string</span> format)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum61" style="color:#606060;">  61:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum62" style="color:#606060;">  62:</span>             <span style="color:#0000ff;">return</span> DataBinder.Eval(row, columnName, format);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum63" style="color:#606060;">  63:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum64" style="color:#606060;">  64:</span>         <span style="color:#0000ff;">bool</span> flip = <span style="color:#0000ff;">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum65" style="color:#606060;">  65:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">string</span> FlipCssClass(<span style="color:#0000ff;">string</span> className, <span style="color:#0000ff;">string</span> alternativeClassName)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum66" style="color:#606060;">  66:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum67" style="color:#606060;">  67:</span>             flip = !flip;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum68" style="color:#606060;">  68:</span>             <span style="color:#0000ff;">return</span> flip ? className : alternativeClassName;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum69" style="color:#606060;">  69:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum70" style="color:#606060;">  70:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum71" style="color:#606060;">  71:</span>         <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">bool</span> GetAtt(<span style="color:#0000ff;">string</span> Name)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum72" style="color:#606060;">  72:</span>         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum73" style="color:#606060;">  73:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum74" style="color:#606060;">  74:</span>             <span style="color:#0000ff;">bool</span> readonlyatt = <span style="color:#0000ff;">false</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum75" style="color:#606060;">  75:</span>             UIAttributes uiatt = TypeDescriptor.GetAttributes(Model).Cast&#60;Attribute&#62;().SingleOrDefault(a =&#62; a.GetType().Name == <span style="color:#0000ff;">typeof</span>(UIAttributes).Name) <span style="color:#0000ff;">as</span> UIAttributes;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum76" style="color:#606060;">  76:</span>             <span style="color:#0000ff;">if</span> ((uiatt != <span style="color:#0000ff;">null</span>) &#38;&#38; uiatt.IsReadOnly)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum77" style="color:#606060;">  77:</span>                 <span style="color:#0000ff;">return</span> uiatt.IsReadOnly;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum78" style="color:#606060;">  78:</span>             PropertyInfo propInfo = Model.GetType().GetProperty(Name);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum79" style="color:#606060;">  79:</span>                 <span style="color:#008000;">//(propInfo =&#62;</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum80" style="color:#606060;">  80:</span>                     {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum81" style="color:#606060;">  81:</span>                         PropertyDescriptor propDescriptor = TypeDescriptor.GetProperties(Model).Cast&#60;PropertyDescriptor&#62;().SingleOrDefault(p =&#62; propInfo.Name == p.Name);</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum82" style="color:#606060;">  82:</span>                         <span style="color:#0000ff;">if</span> (propDescriptor != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum83" style="color:#606060;">  83:</span>                         {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum84" style="color:#606060;">  84:</span>                             UIAttributes attrib = propDescriptor.Attributes.Cast&#60;Attribute&#62;().SingleOrDefault(p =&#62; p.GetType().Name == <span style="color:#0000ff;">typeof</span>(UIAttributes).Name) <span style="color:#0000ff;">as</span> UIAttributes;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum85" style="color:#606060;">  85:</span>                             <span style="color:#0000ff;">if</span> (attrib != <span style="color:#0000ff;">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum86" style="color:#606060;">  86:</span>                             {</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum87" style="color:#606060;">  87:</span>                                 readonlyatt = attrib.IsReadOnly;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum88" style="color:#606060;">  88:</span>                             }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum89" style="color:#606060;">  89:</span>                         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum90" style="color:#606060;">  90:</span>                     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum91" style="color:#606060;">  91:</span>                     <span style="color:#008000;">//);</span></pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum92" style="color:#606060;">  92:</span>                     <span style="color:#0000ff;">return</span> readonlyatt;</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum93" style="color:#606060;">  93:</span>         }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum94" style="color:#606060;">  94:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="text-align:left;line-height:12pt;background-color:white;width:100%;font-family:'Courier New', courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span id="lnum95" style="color:#606060;">  95:</span> }</pre>
<p><!--CRLF--></p>
</div>
</div>
<p>and by using couple of ASP.NET MVC helpful classes like ViewContext, now I can detect which controller called this user control automatically and by adding new property to the the ViewData specifaying the Save Action method name in the controller; that gives more generic to the user control as it is not tight to specific controller or  methods.</li>
</ol>
<p>Still need more enhancements and features like validation and styles, but so far it is nice.</p>
<p>It was very nice challenge to build such a control and I owe to references I mention below a lot.</p>
<p>References:</p>
<ul>
<li><a href="http://stephenwalther.com/blog/archive/2008/06/25/asp-net-mvc-tip-9-create-a-gridview-view-user-control.aspx" target="_blank">ASP.NET MVC Tip #9 – Create a GridView View User Control</a></li>
<li><a href="http://phoenixsoft.com.ua/eng/Blogs/MvcAspNetGridEditableRows.aspx" target="_blank">EDITABLE ROWS. USING HTML TABLE, JQUERY AND AJAX</a></li>
<li><a href="http://www.singingeels.com/Articles/Building_Custom_ASPNET_MVC_Controls.aspx" target="_blank">Building Custom ASP.NET MVC Controls</a></li>
<li>ASP.NET MVC forums and questions posted online.</li>
</ul>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ASP.NET GridView Javascript Search / Filter]]></title>
<link>http://liamwheldon.wordpress.com/2009/11/06/asp-net-gridview-javascript-search-filter/</link>
<pubDate>Fri, 06 Nov 2009 20:14:36 +0000</pubDate>
<dc:creator>liamwheldon</dc:creator>
<guid>http://liamwheldon.wordpress.com/2009/11/06/asp-net-gridview-javascript-search-filter/</guid>
<description><![CDATA[Hi, Recently i needed a fast search for a set of checkboxs so a user could search for names and sele]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi,</p>
<p>Recently i needed a fast search for a set of checkboxs so a user could search for names and select multiple without the need for the page posting back to search. I started looking straight into Javascript but i couldn&#8217;t find a reference directly related to searching a gridview with javascript. I Know i could use AJAX with an update panel but i&#8217;ve found that with AJAX you can get some undesired effects when used in FireFox (AJAX for ASP.NET 2.0).</p>
<p>Here is the Javascript I created to search the gridview and filter matching names in realtime:</p>
<pre style="background:#F5F5F5;"><span style="color:#0000ff;"><span style="color:blue;">function </span></span>UpdateGroups()
{
   <span style="color:blue;"><span style="color:#0000ff;">var </span></span>Groups = document.getElementById(<span style="color:#993300;"><span style="color:#993300;">"&#60;%= GroupsList.ClientID %&#62;"</span></span>);
   <span style="color:blue;"><span style="color:#0000ff;">var </span></span>SearchText = document.getElementById(<span style="color:#993300;"><span style="color:#993300;">"SearchText"</span></span>).value;
   <span style="color:blue;"><span style="color:#0000ff;">var </span></span>SubGroupID = <span style="color:#993300;"><span style="color:#993300;">""</span></span>
   <span style="color:blue;"><span style="color:#0000ff;">var </span></span>GroupsShowing = 0;
   <span style="color:blue;"><span style="color:#0000ff;">for </span></span>(i=1; i&#60;Groups.rows.length; i++)
   {
      <span style="color:blue;"><span style="color:#0000ff;">var </span></span>cell = Groups.rows[i].cells;
      <span style="color:blue;"><span style="color:#0000ff;">var </span></span>HTML = cell[0].innerHTML;
      SubGroupID = cell[1].innerHTML.substring(SearchText.length,0).toLowerCase()
      <span style="color:blue;"><span style="color:#0000ff;">if </span></span>(cell[1].innerHTML.toLowerCase().indexOf(SearchText.toLowerCase()) != -1) {
         Groups.rows[i].style.display = <span style="color:#993300;"><span style="color:#993300;">"table-row"</span></span>;
         GroupsShowing++;
      }
      <span style="color:blue;"><span style="color:#0000ff;">else</span></span>
      {
         Groups.rows[i].style.display =<span style="color:#0000ff;"><span style="color:blue;"> "none"</span></span>;
      }
   }
   <span style="color:blue;"><span style="color:#0000ff;">if </span></span>(GroupsShowing == 0) {
      document.getElementById(<span style="color:#993300;"><span style="color:#993300;">"gridviewDiv"</span></span>).setAttribute(<span style="color:#993300;"><span style="color:#993300;">"Style"</span></span>, <span style="color:#993300;"><span style="color:#993300;">"display:none"</span></span>)
      document.getElementById(<span style="color:#993300;"><span style="color:#993300;">"NoGroupsFound"</span></span>).setAttribute(<span style="color:#993300;"><span style="color:#993300;">"Style"</span></span>, <span style="color:#993300;"><span style="color:#993300;">"display:block;"</span></span>)
   }
   <span style="color:blue;"><span style="color:#0000ff;">else </span></span>{
      document.getElementById(<span style="color:#0000ff;"><span style="color:#993300;"><span style="color:#993300;">"gridviewDiv"</span></span></span>).setAttribute(<span style="color:#993300;"><span style="color:#993300;">"Style"</span></span>, <span style="color:#993300;"><span style="color:#993300;">"display:block;"</span></span>)
      document.getElementById(<span style="color:#993300;"><span style="color:#993300;">"NoGroupsFound"</span></span>).setAttribute(<span style="color:#993300;"><span style="color:#993300;">"Style"</span></span>, <span style="color:#993300;"><span style="color:#993300;">"display:none"</span></span>)
   }
}</pre>
<p class="MsoNormal">And the ASP.NET code is as follows:</p>
<p class="MsoNormal">
<p class="MsoNormal">
<pre style="background:#F5F5F5;">Group filter
&#60;<span style="color:#993300;">br </span>/&#62;
&#60;<span style="color:#993300;">input </span><span style="color:#ff0000;">type</span><span style="color:#0000ff;">="text"</span> <span style="color:#ff0000;">id</span><span style="color:#0000ff;">="SearchText"</span> <span style="color:#ff0000;">name</span><span style="color:#0000ff;">="SearchText"</span> <span style="color:#ff0000;">
       onchange</span><span style="color:#0000ff;">="UpdateGroups();"</span><span style="color:#ff0000;"> onkeyup</span><span style="color:#0000ff;">="UpdateGroups();"</span> /&#62;
&#60;<span style="color:#993300;">br </span>/&#62;
&#60;<span style="color:#993300;">br </span>/&#62;
&#60;<span style="color:#993300;">b</span>&#62;Please select groups&#60;/<span style="color:#993300;">b</span>&#62;
&#60;<span style="color:#993300;">div </span><span style="color:#ff0000;">style</span><span style="color:#0000ff;">="</span><span style="color:#ff0000;">overflow</span>: <span style="color:#0000ff;">scroll</span>; <span style="color:#ff0000;">height</span>: <span style="color:#0000ff;">200px</span>; <span style="color:#ff0000;">
     width</span>: <span style="color:#0000ff;">200px</span>; <span style="color:#ff0000;">margin</span>: <span style="color:#0000ff;">0 auto</span>;<span style="color:#0000ff;">"</span>&#62;
  &#60;<span style="color:#993300;">div </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="gridviewDiv"</span>&#62;
    &#60;<span style="color:#993300;">asp:GridView</span> <span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="GroupsList"</span> <span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span> <span style="color:#ff0000;">
                  AutoGenerateColumns</span><span style="color:#0000ff;">="False"</span><span style="color:#ff0000;"> DataKeyNames</span><span style="color:#0000ff;">="group_id"</span>
                  <span style="color:#ff0000;">DataSourceID</span><span style="color:#0000ff;">="SQLSourceGetGroups"</span> <span style="color:#ff0000;">
                  style</span><span style="color:#0000ff;">="</span><span style="color:#ff0000;">margin</span>: <span style="color:#0000ff;">0 auto</span>;<span style="color:#0000ff;">"</span>&#62;
      &#60;<span style="color:#993300;">Columns</span>&#62;
        &#60;<span style="color:#993300;">asp:TemplateField</span>&#62;
          &#60;<span style="color:#993300;">ItemTemplate</span>&#62;
            &#60;<span style="color:#993300;">asp:CheckBox</span> <span style="color:#ff0000;">ID</span><span style="color:#0000ff;">="GroupSelected"</span> <span style="color:#ff0000;">runat</span><span style="color:#0000ff;">="server"</span> /&#62;
          &#60;/<span style="color:#993300;">ItemTemplate</span>&#62;
        &#60;/<span style="color:#993300;">asp:TemplateField</span>&#62;
        &#60;<span style="color:#993300;">asp:BoundField</span> <span style="color:#ff0000;">DataField</span><span style="color:#0000ff;">="group_id"</span> <span style="color:#ff0000;">HeaderText</span><span style="color:#0000ff;">=""</span> <span style="color:#ff0000;">
                        ReadOnly</span><span style="color:#0000ff;">="True"</span> <span style="color:#ff0000;">SortExpression</span><span style="color:#0000ff;">="group_id"</span> /&#62;
      &#60;/<span style="color:#993300;">Columns</span>&#62;
    &#60;/<span style="color:#993300;">asp:GridView</span>&#62;
  &#60;/<span style="color:#993300;">div</span>&#62;
  &#60;<span style="color:#993300;">br </span>/&#62;
  &#60;<span style="color:#993300;">div </span><span style="color:#ff0000;">id</span><span style="color:#0000ff;">="NoGroupsFound"</span> <span style="color:#ff0000;">style</span><span style="color:#0000ff;">="</span><span style="color:#ff0000;">width</span>: <span style="color:#0000ff;">175px</span>; <span style="color:#ff0000;">display</span>: <span style="color:#0000ff;">none</span>;<span style="color:#0000ff;">"</span> &#62;
    No groups found
  &#60;/<span style="color:#993300;">div</span>&#62;
  &#60;/<span style="color:#993300;">div</span>&#62;
</pre>
<p>The gridview above is contained within a div to allow a scroll affect to look like a checkbox list.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[ASP.NET Gridview: Merging Cells]]></title>
<link>http://viralsarvaiya.wordpress.com/2009/11/04/asp-net-gridview-merging-cells/</link>
<pubDate>Wed, 04 Nov 2009 07:22:55 +0000</pubDate>
<dc:creator>viralsarvaiya</dc:creator>
<guid>http://viralsarvaiya.wordpress.com/2009/11/04/asp-net-gridview-merging-cells/</guid>
<description><![CDATA[I had been searching for a way to merge cells in a GridView If e.Row.DataItemIndex % 2 = 0 Then e.Ro]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I had been searching for a way to merge cells in a GridView</p>
<p>If e.Row.DataItemIndex % 2 = 0 Then<br />
e.Row.Cells(0).RowSpan = 2<br />
e.Row.Cells(1).RowSpan = 2<br />
End If<br />
&#8216;Remove the extra cells created due to row span for odd rows<br />
If e.Row.DataItemIndex % 2 = 1 Then<br />
e.Row.Cells.RemoveAt(0)<br />
e.Row.Cells.RemoveAt(0)<br />
e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Center<br />
End If</p>
<p>This code should take every cell in the first and second columns and merge it with the cell directly below it. Of course, this should be used very carefully, because you could screw up your data if each record does not have another corresponding record with it. However, this shouldn’t be too difficult to program around by adding data checks.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Gridview with inserting ROW]]></title>
<link>http://freebird2081.wordpress.com/2009/10/31/gridview-with-inserting-row/</link>
<pubDate>Sat, 31 Oct 2009 13:47:46 +0000</pubDate>
<dc:creator>freebirds2081</dc:creator>
<guid>http://freebird2081.wordpress.com/2009/10/31/gridview-with-inserting-row/</guid>
<description><![CDATA[Trong một ứng dụng, luôn có phần quản trị các danh mục (categories management) ví dụ như quản lý dan]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">Trong một ứng dụng, luôn có phần quản trị các danh mục (categories management) ví dụ như quản lý danh mục thành phố, danh mục phòng ban,&#8230; Thông thường chúng ta phải sử dụng gridview + formview hoặc detailview để cung cấp CRUD cho user. Nhưng với những loại categories đơn giản và ít thông tin, tớ muốn thiết kế 1 page với 1 gridview duy nhất và user có thể thực hiện CRUD ngay trên gridview đó. Mục đích chính là giảm bớt các thao tác mà user cần phải thực hiện. Nhưng trên thực tế, gridview của asp.net không support insert trực tiếp mà phải thông quan FormView hoặc DetailView. Tớ search google và biết được có 2 cách để tạo ra 1 insertable gridview.</p>
<p style="text-align:justify;">Cách 1:  là tạo ra 1 row dữ liệu rỗng bằng cách sử dụng câu lệnh select của sql để select records của bảng kèm theo 1 record rỗng, rồi xử lý sự kiện OnRowUpdating của GridView. Tham khảo tại đây: <a href="http://www.codeproject.com/KB/webforms/addupdate.aspx" target="_blank">ASP.NET GridView &#8211; Add a new record</a></p>
<p style="text-align:justify;">Cách 2: sử dụng footer của gridview để hiện thị form insert row. Tham khảo bài viết của John Sanborn -<a href="http://aspnet.4guysfromrolla.com/articles/021203-1.aspx" target="_blank"> Adding a New Record to the DataGrid</a></p>
<p style="text-align:justify;">Tớ thích cách 2 hơn vì nó đơn giản và rõ ràng, không phải viết lại select store procedure <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> . Tớ sẽ trình bày phương pháp này theo cách của mình, gồm 4 bước như dưới đây</p>
<p style="text-align:justify;"><em><strong>Bài toán: cung cấp chức năng CRUD &#8211; Create Read Update Delete để quản lý bảng dữ liệu EducationUnit gồm 3 trường ID, Name, Note.</strong></em></p>
<p style="text-align:justify;">1. Viết các store procedure và Business Object (EducationUnit.cs) + DAL (EducationUnitDB.cs) + Business Layer (EducationUnitManager.cs)</p>
<p style="text-align:justify;">2. Tạo Web page chứa gridview với datasource là 1 ObjectDatasource sử dụng các hàm của object EducationUnitManager trong Business Layer</p>
<p style="text-align:justify;"><em>Chú ý: bạn có thể sử dụng datasource loại khác cũng chẳng sao.  Nếu ngại thì có thể dùng Design view của VS để sinh ra SQLDatasource 1 cách nhanh chóng. mà không cần phải làm bước 1</em></p>
<p style="text-align:justify;">3. Thiết lập thuộc tính ShowFooter của gridview = true.</p>
<p style="text-align:justify;">Convert toàn bộ BoundField của GridView sang TemplateField.</p>
<p style="text-align:justify;">Thêm FooterTemplate cho các field.</p>
<pre>&#60;asp:GridView ID="gvEduUnit" runat="server"
        AutoGenerateColumns="False" DataKeyNames="ID"
        DataSourceID="odsEduUnit" Width="100%" <strong>ShowFooter="True"</strong> &#62;
        &#60;Columns&#62;
            &#60;asp:TemplateField HeaderText="ID" InsertVisible="False"
                SortExpression="ID"&#62;
                &#60;EditItemTemplate&#62;
                    &#60;asp:Label ID="Label1" runat="server"
                         Text='&#60;%# Eval("ID") %&#62;'&#62;&#60;/asp:Label&#62;
                &#60;/EditItemTemplate&#62;
                &#60;ItemTemplate&#62;
                    &#60;asp:Label ID="Label1" runat="server"
                        Text='&#60;%# Bind("ID") %&#62;'&#62;&#60;/asp:Label&#62;
                &#60;/ItemTemplate&#62;
                &#60;HeaderStyle Width="30px" /&#62;
            &#60;/asp:TemplateField&#62;
            &#60;asp:TemplateField HeaderText="Name" SortExpression="Name"&#62;
                &#60;EditItemTemplate&#62;
                    &#60;asp:TextBox ID="TextBox1" runat="server"
                        Text='&#60;%# Bind("Name") %&#62;' Width="100%"&#62;&#60;/asp:TextBox&#62;
                &#60;/EditItemTemplate&#62;
                &#60;ItemTemplate&#62;
                    &#60;asp:Label ID="Label2" runat="server"
                        Text='&#60;%# Bind("Name") %&#62;'&#62;&#60;/asp:Label&#62;
                &#60;/ItemTemplate&#62;
                <strong>&#60;FooterTemplate&#62;
                    &#60;asp:TextBox ID="inputName" runat="server" </strong>
<strong>                        Width="95%"&#62;&#60;/asp:TextBox&#62;
                &#60;/FooterTemplate&#62;</strong>
                &#60;ControlStyle Width="95%" /&#62;
                &#60;HeaderStyle Width="200px" /&#62;
            &#60;/asp:TemplateField&#62;
            &#60;asp:TemplateField HeaderText="Note" SortExpression="Note"&#62;
                &#60;EditItemTemplate&#62;
                    &#60;asp:TextBox ID="TextBox2" runat="server"
                       Text='&#60;%# Bind("Note") %&#62;' TextMode="MultiLine"&#62;
                    &#60;/asp:TextBox&#62;
                &#60;/EditItemTemplate&#62;
                &#60;ItemTemplate&#62;
                    &#60;asp:Label ID="Label3" runat="server"
                      Text='&#60;%# Bind("Note") %&#62;'&#62;&#60;/asp:Label&#62;
                &#60;/ItemTemplate&#62;
                <strong>&#60;FooterTemplate&#62;
                    &#60;asp:TextBox ID="inputNote" runat="server" </strong>
<strong>                        TextMode="MultiLine" Width="95%"&#62;</strong>
<strong>                    &#60;/asp:TextBox&#62;
                &#60;/FooterTemplate&#62;</strong>
                &#60;ControlStyle Width="95%" /&#62;
            &#60;/asp:TemplateField&#62;
            &#60;asp:TemplateField ShowHeader="False"&#62;
                &#60;EditItemTemplate&#62;
                &#60;div align="right"&#62;
                    &#60;asp:LinkButton ID="LinkButton1" runat="server"
                        CausesValidation="True" CommandName="Update"&#62;
                        &#60;asp:Image ID="imgUpdate" runat="server"
                            ImageUrl="~/img/action_check.gif"
                            AlternateText="lưu" /&#62;
                    &#60;/asp:LinkButton&#62;
                    &#60;asp:LinkButton ID="LinkButton2" runat="server"
                        CausesValidation="False" CommandName="Cancel"&#62;
                        &#60;asp:Image ID="imgCancel" runat="server"
                             ImageUrl="~/img/action_delete.gif"
                             AlternateText="hủy bỏ" /&#62;
                    &#60;/asp:LinkButton&#62;
                &#60;/div&#62;
                &#60;/EditItemTemplate&#62;
                &#60;ItemTemplate&#62;
                &#60;div align="right"&#62;
                    &#60;asp:LinkButton ID="LinkButton1" runat="server"
                        CausesValidation="False" CommandName="Edit"&#62;
                        &#60;asp:Image ID="imgEdit" runat="server"
                             ImageUrl="~/img/reply.gif"
                             AlternateText="sửa" /&#62;
                    &#60;/asp:LinkButton&#62;
                &#60;/div&#62;
                &#60;/ItemTemplate&#62;
                &#60;HeaderStyle Width="40px" /&#62;
                <strong>&#60;FooterTemplate&#62;
                &#60;div align="right"&#62;
                    &#60;asp:LinkButton ID="btnInsert" runat="server" </strong>
<strong>                        CausesValidation="true" CommandName="Insert" </strong>
<strong>                        <span style="color:#ff0000;">OnClick="btnInsert_Click"</span> &#62;
                        &#60;asp:Image ID="imgInsert" runat="server" </strong>
<strong>                             ImageUrl="~/img/action_add.gif" </strong>
<strong>                             AlternateText="lưu" /&#62;
                    &#60;/asp:LinkButton&#62;
                &#60;/div&#62;
                &#60;/FooterTemplate&#62;</strong>
            &#60;/asp:TemplateField&#62;
        &#60;/Columns&#62;
        &#60;FooterStyle VerticalAlign="Top" /&#62;
        &#60;RowStyle VerticalAlign="Top" /&#62;
    &#60;/asp:GridView&#62;
&#60;asp:ObjectDataSource ID="odsEduUnit" runat="server"
    DataObjectTypeName="DHD.DMS.BusinessObject.EducationUnit"
    DeleteMethod="Delete" InsertMethod="Save" OldValuesParameterFormatString="original_{0}"
    SelectMethod="GetList" TypeName="DHD.DMS.BusinessLayer.EducationUnitManager"
    UpdateMethod="Save"&#62;
&#60;/asp:ObjectDataSource&#62;</pre>
<p>Như vậy footer cho trường ID sẽ bỏ qua (bởi tớ đặt chế độ tự tăng cho ID), footer cho trường Name là một textbox (inputName), cho trường Note là multiline textbox (inputNote), footer cho cột chứa linkbutton edit là 1 linkbutton (btnInsert) với sự kiện OnClick = btnInsertClick.</p>
<p>4. Xử lý hàm btnInsertClick như sau:</p>
<pre>protected void btnInsert_Click(object sender, EventArgs e)
{
    // get controls from FooterRow
    TextBox txtName = gvEduUnit.FooterRow.FindControl("inputName") as TextBox;
    TextBox txtNote = gvEduUnit.FooterRow.FindControl("inputNote") as TextBox;

    // get data from controls
    DHD.DMS.BusinessObject.EducationUnit item = new DHD.DMS.BusinessObject.EducationUnit();
    item.Name = txtName.Text;
    item.Note = txtNote.Text;

    // action to insert record into table on database
    DHD.DMS.BusinessLayer.EducationUnitManager.Save(item);

    // rebind gridview
    gvEduUnit.DataBind();
}</pre>
<p>Kết quả:</p>
<p><img class="alignnone size-full wp-image-117" title="insertableGridview" src="http://freebird2081.wordpress.com/files/2009/10/insertablegridview.jpg" alt="insertableGridview" width="600" height="146" /></p>
<p>Giờ tớ đã có 1 insertable gridview hoạt động ngon lành rồi đấy!!! Phương pháp này có thể chưa thực sự hay vì trong TH đã sử dụng footer để phục vụ cho việc trình bầy thì bạn không thể dùng phương pháp này. Có lẽ ngoài 2 phương pháp tớ đã đề cập, chắc chắn còn cách khác hay hơn để có được insertable gridview (không kể sài third party <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Break out of WebForm_DoPostBackWithOptions Hell]]></title>
<link>http://computermutt.wordpress.com/2009/10/28/break-out-of-webform_dopostbackwithoptions-hell/</link>
<pubDate>Wed, 28 Oct 2009 22:35:31 +0000</pubDate>
<dc:creator>Mike Malter</dc:creator>
<guid>http://computermutt.wordpress.com/2009/10/28/break-out-of-webform_dopostbackwithoptions-hell/</guid>
<description><![CDATA[I have been going nuts all day trying to get a link button to fire its command event and cause a pos]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I have been going nuts all day trying to get a link button to fire its command event and cause a postback in a GridView control.  On this particular page, whenever I click on the link, I get a WebForm_DoPostBackWithOptions instead of __doPostback, and of course I never hit the grid&#8217;s command event in my page behind.</p>
<p>The solution?  Set <span style="color:#ff0000;font-size:x-small;"><span style="color:#ff0000;font-size:x-small;">causesvalidation</span></span><span style="color:#0000ff;font-size:x-small;"><span style="color:#0000ff;font-size:x-small;">=&#8221;false&#8221; <span style="color:#000000;">in the link button and the command event will fire.   Why, I don&#8217;t know, this just works and hopefully you&#8217;ll find this post before having to spend too many hours trying to figure it out.</span></span></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Creating Custom GridView Control]]></title>
<link>http://rthumati.wordpress.com/2009/10/28/creating-custom-gridview-control/</link>
<pubDate>Wed, 28 Oct 2009 17:08:30 +0000</pubDate>
<dc:creator>ravivarmathumati</dc:creator>
<guid>http://rthumati.wordpress.com/2009/10/28/creating-custom-gridview-control/</guid>
<description><![CDATA[In this article, we will examines the creation of a new custom GridView control from scratch, which ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;">In this article, we will examines the creation of a new custom GridView control from scratch, which allows the developer to include a checkbox column to the GridView control automatically with embedded JavaScript code to check/uncheck the checkbox column without the need to write any bit of code. He begins with comprehensive coverage of the steps involved in customization of the GridView class and implementation of template classes. Towards the end of the article, Abdulla examines the usage of the control with Visual Studio 2005. The article also covers how to embed a JavaScript file with a custom control and how to use it later on with the help of detailed analysis, relevant source code, and screenshots.                                                                   </p>
<p style="text-align:justify;"><strong>Article Contents</strong>:</p>
<ul style="text-align:justify;">
<li>Customizing the GridView Class</li>
<li>Supporting Client Side Functionality</li>
<li>Implementing Templates Classes</li>
<li>Using the Control</li>
<li>Conclusion</li>
</ul>
<p style="text-align:justify;"><strong>Customizing the GridView Class</strong></p>
<p style="text-align:justify;">Let us begin creating our new custom GridView control, open your Visual Studio then create a new Class library project and name it as &#8220;MyCustomControl.&#8221;</p>
<p style="text-align:justify;">First of all, you have to add some references to allow you to use the needed namespaces and classes, below are the needed references:</p>
<p style="text-align:justify;">1.    System.Design</p>
<p style="text-align:justify;">2.    System.Drawing</p>
<p style="text-align:justify;">3.    System.Web </p>
<p style="text-align:justify;">4.    System.Web.Extensions </p>
<p style="text-align:justify;">5.    System.Web.Extensions.Design</p>
<p style="text-align:justify;">Then create a new class and name it &#8220;CustomGrid.&#8221;</p>
<p style="text-align:justify;">Inheriting the GridView class is much better than creating a new databound control from scratch, that give us the benefits of functions and subroutines already existing in the GridView class.</p>
<p style="text-align:justify;">Listing 1</p>
<pre style="text-align:justify;">&#60;Assembly: TagPrefix("MyCustomControl.CustomsControls", "asp")&#62; </pre>
<pre style="text-align:justify;">&#60;Assembly: WebResource("MyCustomControl.CustomGridJS.js", "text/javascript")&#62; </pre>
<pre style="text-align:justify;">Namespace CustomsControls</pre>
<pre style="text-align:justify;">&#60;ToolboxData("&#60;{0}:CustomGrid runat=""server""&#62;&#60;/{0}:CustomGrid&#62;")&#62; _</pre>
<pre style="text-align:justify;">Partial Public Class CustomGrid</pre>
<pre style="text-align:justify;">Inherits GridView</pre>
<pre style="text-align:justify;">'My Code Here</pre>
<pre style="text-align:justify;">End Class</pre>
<p style="text-align:justify;">We will create a property for including the checkbox column to allow the developer to add the column automatically, which is implemented in Listing 2.</p>
<p style="text-align:justify;">Listing 2</p>
<pre style="text-align:justify;">''' &#60;summary&#62;</pre>
<pre style="text-align:justify;">''' Add checkbox column to the gridview.</pre>
<pre style="text-align:justify;">''' &#60;/summary&#62;</pre>
<pre style="text-align:justify;">''' &#60;value&#62;&#60;/value&#62;</pre>
<pre style="text-align:justify;">''' &#60;returns&#62;&#60;/returns&#62;</pre>
<pre style="text-align:justify;">''' &#60;remarks&#62;&#60;/remarks&#62;</pre>
<pre style="text-align:justify;">&#60;Category("Behavior")&#62; _</pre>
<pre style="text-align:justify;">          &#60;Description("Add checkbox column to the gridview.")&#62; _</pre>
<pre style="text-align:justify;">          &#60;DefaultValue(False)&#62; _</pre>
<pre style="text-align:justify;">          Public Property IncludeColumnCheckBox() As Boolean</pre>
<pre style="text-align:justify;">  Get</pre>
<pre style="text-align:justify;">  If String.IsNullOrEmpty(ViewState("IncludeColumnCheckBox")) Then</pre>
<pre style="text-align:justify;">    Return False</pre>
<pre style="text-align:justify;">  Else</pre>
<pre style="text-align:justify;">    Return DirectCast(ViewState("IncludeColumnCheckBox"), Boolean)</pre>
<pre style="text-align:justify;">  End If</pre>
<pre style="text-align:justify;">  End Get</pre>
<pre style="text-align:justify;">  Set(ByVal Value As Boolean)</pre>
<pre style="text-align:justify;">  ViewState("IncludeColumnCheckBox") = Value</pre>
<pre style="text-align:justify;">  End Set</pre>
<pre style="text-align:justify;">End Property</pre>
<p style="text-align:justify;">Now we will override the CreateColumns function which is responsible for creating the columns, and there we will add our new checkbox column, as in Listing 3.</p>
<p style="text-align:justify;">Listing 3</p>
<pre style="text-align:justify;">Protected Overrides Function CreateColumns(ByVal dataSource As PagedDataSource, _</pre>
<pre style="text-align:justify;">ByVal useDataSource As Boolean) As ICollection</pre>
<pre style="text-align:justify;">Dim columnList As ICollection = MyBase.CreateColumns(dataSource, useDataSource)</pre>
<pre style="text-align:justify;">  If Not IncludeColumnCheckBox Then</pre>
<pre style="text-align:justify;">    Return columnList</pre>
<pre style="text-align:justify;">  End If</pre>
<pre style="text-align:justify;">  Dim list As ArrayList = New ArrayList(columnList)</pre>
<pre style="text-align:justify;">  Dim _CheckBoxColumn As New MyTemplateField</pre>
<pre style="text-align:justify;">  list.Insert(0, _CheckBoxColumn)</pre>
<pre style="text-align:justify;">  Return list</pre>
<pre style="text-align:justify;">End Function</pre>
<p style="text-align:justify;">You may note that I am declaring an object from a template class that I created before I called MyTemplateField, and that the GridView column consisted from the set of templates classes (Header, Item, Alternate and footer).</p>
<p style="text-align:justify;">I will illustrate these templates classes in the Implementing Templates classes section,</p>
<p style="text-align:justify;">Developers do not need to write multi lines of code to get the ID&#8217;s of the selected rows; we will return these ID&#8217;s simply by writing a new property called GetCheckedRows which is shown below.</p>
<p style="text-align:justify;">Listing 4</p>
<pre style="text-align:justify;">''' &#60;summary&#62;</pre>
<pre style="text-align:justify;">''' Return list of IDs joined with ',' separators</pre>
<pre style="text-align:justify;">''' &#60;/summary&#62;</pre>
<pre style="text-align:justify;">''' &#60;value&#62;&#60;/value&#62;</pre>
<pre style="text-align:justify;">''' &#60;returns&#62;&#60;/returns&#62;</pre>
<pre style="text-align:justify;">''' &#60;remarks&#62;&#60;/remarks&#62;</pre>
<pre style="text-align:justify;">&#60;Browsable(False)&#62; _</pre>
<pre style="text-align:justify;">           Public ReadOnly Property GetCheckedRows() As String</pre>
<pre style="text-align:justify;">  Get</pre>
<pre style="text-align:justify;">  Dim _collectionIds As String = String.Empty</pre>
<pre style="text-align:justify;">  If DataKeys.Count &#62; 0 Then</pre>
<pre style="text-align:justify;"> </pre>
<pre style="text-align:justify;">    For i As Integer = 0 To Rows.Count - 1</pre>
<pre style="text-align:justify;">      If Rows(i).RowType = DataControlRowType.DataRow Then</pre>
<pre style="text-align:justify;">        If DirectCast(Rows(i).FindControl("ChkItem"), CheckBox).Checked Then</pre>
<pre style="text-align:justify;">          If _collectionIds = String.Empty Then</pre>
<pre style="text-align:justify;">            _collectionIds = DataKeys(Rows(i).RowIndex).Value</pre>
<pre style="text-align:justify;">          Else</pre>
<pre style="text-align:justify;">            _collectionIds &#38; = "," &#38; DataKeys(Rows(i).RowIndex).Value</pre>
<pre style="text-align:justify;">          End If</pre>
<pre style="text-align:justify;">        End If</pre>
<pre style="text-align:justify;">      End If</pre>
<pre style="text-align:justify;">    Next</pre>
<pre style="text-align:justify;">  End If</pre>
<pre style="text-align:justify;">  Return _collectionIds</pre>
<pre style="text-align:justify;">  End Get</pre>
<pre style="text-align:justify;">End Property</pre>
<p style="text-align:justify;"><strong>Supporting Client Side Functionality</strong></p>
<p style="text-align:justify;">As I mention before, our new custom GridView control will support checking/unchecking the checkbox column in client-side using JavaScript functions embedded with the control, so we need to assign the JavaScript function to the checkbox element in the Header template of the GridView, and that occurs at the row created subroutine as illustrated in Listing 5.</p>
<p style="text-align:justify;">Listing 5</p>
<pre style="text-align:justify;">Protected Overloads Overrides Sub OnRowCreated(ByVal e As GridViewRowEventArgs)</pre>
<pre style="text-align:justify;">            MyBase.OnRowCreated(e)</pre>
<pre style="text-align:justify;">If IncludeColumnCheckBox Then</pre>
<pre style="text-align:justify;">  If e.Row.RowType = DataControlRowType.Header Then</pre>
<pre style="text-align:justify;">  DirectCast(e.Row.FindControl("ChkHeader"), CheckBox).Attributes.Add("onclick", _</pre>
<pre style="text-align:justify;">  "ObjJs_" &#38; Me.ID &#38; ".CheckUnCheckRows(this.checked)")</pre>
<pre style="text-align:justify;">  End If</pre>
<pre style="text-align:justify;">End If</pre>
<pre style="text-align:justify;">End Sub</pre>
<p style="text-align:justify;">We have to tell the Page that our custom control has JavaScript files that need to be registered when the final HTML is generated for that page. So we need to write a bit of code in the OnInit subroutine. </p>
<p style="text-align:justify;">Listing 6</p>
<pre style="text-align:justify;">Protected Overrides Sub OnInit(ByVal e As EventArgs)</pre>
<pre style="text-align:justify;">  MyBase.OnInit(e)</pre>
<pre style="text-align:justify;">  Me.Page.ClientScript.RegisterClientScriptInclude(Me.GetType(), "CustomGridJS", _</pre>
<pre style="text-align:justify;">  Page.ClientScript.GetWebResourceUrl(Me.GetType(),</pre>
<pre style="text-align:justify;">  "MyCustomControl.CustomGridJS.js"))</pre>
<pre style="text-align:justify;">End Sub</pre>
<p style="text-align:justify;">And we should declare a JavaScript object from the JavaScript file which contains the client side code as in Listing 7. Using this way allows us to drag and drop our new custom control many times in the page without worrying about confliction between these instances.</p>
<p style="text-align:justify;">Listing 7</p>
<pre style="text-align:justify;">Public Overrides Sub Rendercontrol(ByVal writer As System.Web.UI.HtmlTextWriter)</pre>
<pre style="text-align:justify;">  MyBase.RenderControl(writer)</pre>
<pre style="text-align:justify;">  ScriptManager.RegisterStartupScript(Page, Me.GetType, Me.ID &#38; "JSBlock", "var</pre>
<pre style="text-align:justify;">  ObjJs_" &#38; Me.ID &#38; " = new GridClass('" &#38; Me.ClientID &#38; "');", True)</pre>
<pre style="text-align:justify;">End Sub</pre>
<p style="text-align:justify;">I recommend you download the source so that you can preview the JavaScript file which is responsible for the client side functionality.</p>
<p style="text-align:justify;"><strong>Implementing Templates Classes</strong></p>
<p style="text-align:justify;">As I said before, the GridView column consists from the set of Template classes (Header, Item, Alternate and Footer). And in our case we need to implement two template classes (Header and Item templates).</p>
<p style="text-align:justify;">Look at listing 8; I will use these two template classes in the constructor of the template field class, and we will create an object from that template field class.</p>
<p style="text-align:justify;">Listing 8</p>
<pre style="text-align:justify;">'Header Template Class</pre>
<pre style="text-align:justify;">NotInheritable Class MyHeaderTemplate</pre>
<pre style="text-align:justify;">Implements ITemplate</pre>
<pre style="text-align:justify;"> </pre>
<pre style="text-align:justify;">Sub InstantiateIn(ByVal owner As Control) Implements ITemplate.InstantiateIn</pre>
<pre style="text-align:justify;">  Dim chkboxHeader As New CheckBox</pre>
<pre style="text-align:justify;">  chkboxHeader.ID = "ChkHeader"</pre>
<pre style="text-align:justify;">  owner.Controls.Add(chkboxHeader)</pre>
<pre style="text-align:justify;">End Sub</pre>
<pre style="text-align:justify;">End Class</pre>
<pre style="text-align:justify;">'Item Template Class</pre>
<pre style="text-align:justify;">NotInheritable Class MyItemTemplate</pre>
<pre style="text-align:justify;">Implements ITemplate</pre>
<pre style="text-align:justify;">Sub InstantiateIn(ByVal owner As Control) Implements ITemplate.InstantiateIn</pre>
<pre style="text-align:justify;">  Dim chkboxItem As New CheckBox</pre>
<pre style="text-align:justify;">  chkboxItem.ID = "ChkItem"</pre>
<pre style="text-align:justify;">  owner.Controls.Add(chkboxItem)</pre>
<pre style="text-align:justify;">End Sub</pre>
<pre style="text-align:justify;">End Class</pre>
<p style="text-align:justify;">Here we are setting the look and feel of the header and item template field for the checkbox column; as you can see we are setting the vertical and horizontal align for the header and item template.</p>
<p style="text-align:justify;">Listing 9</p>
<pre style="text-align:justify;">Class MyTemplateField</pre>
<pre style="text-align:justify;">  Inherits TemplateField</pre>
<pre style="text-align:justify;">  Private _owner As TemplateOwner</pre>
<pre style="text-align:justify;">  Private _header As MyHeaderTemplate</pre>
<pre style="text-align:justify;">  Private _item As MyItemTemplate</pre>
<pre style="text-align:justify;">  Public Sub New()</pre>
<pre style="text-align:justify;">    _owner = New TemplateOwner</pre>
<pre style="text-align:justify;">    _header = New MyHeaderTemplate</pre>
<pre style="text-align:justify;">    _item = New MyItemTemplate</pre>
<pre style="text-align:justify;">    _header.InstantiateIn(_owner)</pre>
<pre style="text-align:justify;">    Me.HeaderTemplate = _header</pre>
<pre style="text-align:justify;">    _item.InstantiateIn(_owner)</pre>
<pre style="text-align:justify;">    Me.ItemTemplate = _item</pre>
<pre style="text-align:justify;">    Me.HeaderStyle.VerticalAlign = VerticalAlign.Middle</pre>
<pre style="text-align:justify;">    Me.HeaderStyle.HorizontalAlign = HorizontalAlign.Center</pre>
<pre style="text-align:justify;">    Me.HeaderStyle.Width = Unit.Percentage(3)</pre>
<pre style="text-align:justify;">    Me.ItemStyle.VerticalAlign = VerticalAlign.Middle</pre>
<pre style="text-align:justify;">    Me.ItemStyle.HorizontalAlign = HorizontalAlign.Center</pre>
<pre style="text-align:justify;">  End Sub</pre>
<pre style="text-align:justify;">End Class</pre>
<pre style="text-align:justify;">&#60;ToolboxItem(False)&#62; _</pre>
<pre style="text-align:justify;">             Public Class TemplateOwner</pre>
<pre style="text-align:justify;">  Inherits WebControl</pre>
<pre style="text-align:justify;">End Class</pre>
<p style="text-align:justify;"><strong>Using the Control</strong></p>
<p style="text-align:justify;">To add the custom GridView control in your toolbox, follow the subsequent steps:</p>
<p style="text-align:justify;">Right click on the toolbox window then choose &#8220;Add Tab.&#8221;</p>
<p style="text-align:justify;">Type the name you want for the new tab, right click over it, and click &#8220;Choose Items.&#8221;</p>
<p style="text-align:justify;">Click on the Browse button in the &#8220;.NET Framework Components&#8221; tab, go to the custom GridView project, open the bin folder, and choose MyCustomControl.dll.</p>
<p style="text-align:justify;">The result is shown Figure 1.</p>
<p style="text-align:justify;">Figure 1</p>
<p style="text-align:justify;"><a href="http://rthumati.wordpress.com/files/2009/10/gridview3.jpg"><img class="alignnone size-full wp-image-1619" title="gridview3" src="http://rthumati.wordpress.com/files/2009/10/gridview3.jpg" alt="gridview3" width="171" height="276" /></a> </p>
<p style="text-align:justify;">Now drag the custom GridView control, go the properties window, and check the IncludeColumnCheckBox property, you will note that a new checkbox column has been added to the Gridview automatically.</p>
<p style="text-align:justify;">Figure 2</p>
<p style="text-align:justify;"><a href="http://rthumati.wordpress.com/files/2009/10/gridview4.jpg"><img class="alignnone size-full wp-image-1620" title="gridview4" src="http://rthumati.wordpress.com/files/2009/10/gridview4.jpg" alt="gridview4" width="263" height="259" /></a></p>
<p style="text-align:justify;">View the page in a browser, and click the checkbox element in the GridView header row; you will note that all checkboxes are checked/unchecked Client side without the need from you to write any bit of code. And that is why Microsoft gives us the ability to create a new custom control!</p>
<p style="text-align:justify;">Figure 3</p>
<p style="text-align:justify;"><a href="http://rthumati.wordpress.com/files/2009/10/gridview5.jpg"><img class="alignnone size-full wp-image-1621" title="gridview5" src="http://rthumati.wordpress.com/files/2009/10/gridview5.jpg" alt="gridview5" width="613" height="352" /></a></p>
<p style="text-align:justify;"><strong>Conclusion </strong></p>
<p style="text-align:justify;">In this article, I demonstrate how to create a custom GridView control and how to add a new checkbox column automatically. Also, we have learned how to embedded JavaScript file with custom controls and how to use it in the page.</p>
<p style="text-align:justify;">In addition, we have learned how to create a template field classes and how to declare an object from these classes. I encourage you to download the source code so you can see all what we have done in more details.</p>
<p style="text-align:justify;"> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[TemplateField Add Number Format]]></title>
<link>http://kuanglian2000.wordpress.com/2009/10/23/templatefield-add-number-format/</link>
<pubDate>Fri, 23 Oct 2009 07:53:07 +0000</pubDate>
<dc:creator>kuanglian2000</dc:creator>
<guid>http://kuanglian2000.wordpress.com/2009/10/23/templatefield-add-number-format/</guid>
<description><![CDATA[前端的寫法： &lt;asp:templatefield&gt; &lt;itemtemplate&gt; &lt;asp:label id="Label1" runat="server" text=]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><pre><span style="color:#800080;">前端的寫法：</span>
&#60;asp:templatefield&#62;
	&#60;itemtemplate&#62;
		&#60;asp:label id="Label1" runat="server" <span style="color:#008000;"><strong>text='&#60;%# Eval("MyDateField", "{0:d}") %&#62;'</strong> /&#62;</span>
	&#60;/itemtemplate&#62;
&#60;/asp:templatefield&#62;

<span style="color:#0000ff;">這個很好用，一定要記起來</span>
增加千分位請用　"{0:N0}"
日期格式請用　"{0:d}"

<span style="color:#800080;">後端的寫法：</span>
lblGVTotal.Text = <span style="color:#008000;"><strong>Total.ToString("N0");</strong></span></pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Hidden Column di Gridview]]></title>
<link>http://angkringankode.wordpress.com/2009/10/22/hidden-column-di-gridview/</link>
<pubDate>Thu, 22 Oct 2009 04:48:00 +0000</pubDate>
<dc:creator>Yuniar</dc:creator>
<guid>http://angkringankode.wordpress.com/2009/10/22/hidden-column-di-gridview/</guid>
<description><![CDATA[Aku pernah membuat aplikasi ASP.net. Di aplikasi tersebut aku menambahkan tool gridview untuk menamp]]></description>
<content:encoded><![CDATA[Aku pernah membuat aplikasi ASP.net. Di aplikasi tersebut aku menambahkan tool gridview untuk menamp]]></content:encoded>
</item>
<item>
<title><![CDATA[GridView Export Excel]]></title>
<link>http://thebest51.wordpress.com/2009/10/21/gridview-export-excel/</link>
<pubDate>Wed, 21 Oct 2009 14:52:37 +0000</pubDate>
<dc:creator>thebest51</dc:creator>
<guid>http://thebest51.wordpress.com/2009/10/21/gridview-export-excel/</guid>
<description><![CDATA[Hi All here really useful(an working) C# class to export GrdidView&#8217;s Contents to Excel&#8217;s]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi All here really useful(an working) C# class to export GrdidView&#8217;s Contents to Excel&#8217;s File TAKED FROM :<br />
<a href="http://mattberseth.com/blog/2007/04/export_gridview_to_excel_1.html">Matt Berseth</a><br />
 Really Thanks Matt!!</p>
<p>
Waiting to Posting C# Code&#8230;<br />
<code></p>
<div style="visibility:hidden;">
using System;<br />
using System.Data;<br />
using System.Configuration;<br />
using System.IO;<br />
using System.Web;<br />
using System.Web.Security;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
using System.Web.UI.HtmlControls;</p>
<p>///<br />
///<br />
///<br />
public class GridViewExportUtil<br />
{<br />
    ///<br />
    ///<br />
    ///<br />
    ///<br />
    ///<br />
    public static void Export(string fileName, GridView gv)<br />
    {<br />
        HttpContext.Current.Response.Clear();<br />
        HttpContext.Current.Response.AddHeader(<br />
            "content-disposition", string.Format("attachment; filename={0}", fileName));<br />
        HttpContext.Current.Response.ContentType = "application/ms-excel";</p>
<p>        using (StringWriter sw = new StringWriter())<br />
        {<br />
            using (HtmlTextWriter htw = new HtmlTextWriter(sw))<br />
            {<br />
                //  Create a form to contain the grid<br />
                Table table = new Table();</p>
<p>                //  add the header row to the table<br />
                if (gv.HeaderRow != null)<br />
                {<br />
                    GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);<br />
                    table.Rows.Add(gv.HeaderRow);<br />
                }</p>
<p>                //  add each of the data rows to the table<br />
                foreach (GridViewRow row in gv.Rows)<br />
                {<br />
                    GridViewExportUtil.PrepareControlForExport(row);<br />
                    row.Cells[1].Text = "'" + row.Cells[1].Text;<br />
                    table.Rows.Add(row);<br />
                }</p>
<p>                //  add the footer row to the table<br />
                if (gv.FooterRow != null)<br />
                {<br />
                    GridViewExportUtil.PrepareControlForExport(gv.FooterRow);<br />
                    table.Rows.Add(gv.FooterRow);<br />
                }</p>
<p>                //  render the table into the htmlwriter<br />
                table.RenderControl(htw);</p>
<p>                //  render the htmlwriter into the response<br />
                HttpContext.Current.Response.Write(sw.ToString());<br />
                HttpContext.Current.Response.End();<br />
            }<br />
        }<br />
    }</p>
<p>    ///<br />
    /// Replace any of the contained controls with literals<br />
    ///<br />
    ///<br />
    private static void PrepareControlForExport(Control control)<br />
    {<br />
        for (int i = 0; i &#60; control.Controls.Count; i++)<br />
        {<br />
            Control current = control.Controls[i];<br />
            if (current is LinkButton)<br />
            {<br />
                control.Controls.Remove(current);<br />
                control.Controls.AddAt(i, new LiteralControl((current as LinkButton).Text));<br />
            }<br />
            else if (current is ImageButton)<br />
            {<br />
                control.Controls.Remove(current);<br />
                control.Controls.AddAt(i, new LiteralControl((current as ImageButton).AlternateText));<br />
            }<br />
            else if (current is HyperLink)<br />
            {<br />
                control.Controls.Remove(current);<br />
                control.Controls.AddAt(i, new LiteralControl((current as HyperLink).Text));<br />
            }<br />
            else if (current is DropDownList)<br />
            {<br />
                control.Controls.Remove(current);<br />
                control.Controls.AddAt(i, new LiteralControl((current as DropDownList).SelectedItem.Text));<br />
            }<br />
            else if (current is CheckBox)<br />
            {<br />
                control.Controls.Remove(current);<br />
                control.Controls.AddAt(i, new LiteralControl((current as CheckBox).Checked ? &#34;True&#34; : &#34;False&#34;));<br />
            }</p>
<p>            if (current.HasControls())<br />
            {<br />
                GridViewExportUtil.PrepareControlForExport(current);<br />
            }<br />
        }<br />
    }<br />
}</p>
</div>
<p></code></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Get RowIndex from edit LinkButton in GridView]]></title>
<link>http://freebird2081.wordpress.com/2009/10/21/get-rowindex-from-edit-linkbutton-in-gridview/</link>
<pubDate>Wed, 21 Oct 2009 09:17:16 +0000</pubDate>
<dc:creator>freebirds2081</dc:creator>
<guid>http://freebird2081.wordpress.com/2009/10/21/get-rowindex-from-edit-linkbutton-in-gridview/</guid>
<description><![CDATA[Mình đang viết chức năng quản lý nhân viên trong một dự án web nhỏ. Chức năng này gồm liệt kê danh s]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Mình đang viết chức năng quản lý nhân viên trong một dự án web nhỏ. Chức năng này gồm liệt kê danh sách các nhân viên, form update/insert nhân viên, &#8230; Với ý tưởng là trên gridview chứa danh sách nhân viên, user chọn edit linkbutton thì gridview sẽ invisible và form edit sẽ được visible. FB thực hiện như sau:</p>
<ol>
<li>Create User Web control ucManageStaff.ascx</li>
<li>Add 1 gvStaffList (gridview control) vào ucManageStaff để liệt kê danh sách nhân viên. Setup datasource cho gvStaffList  và <strong>set DataKeyNames = StaffID (field key of Staff table)</strong></li>
<li>Add fvStaffEdit (formview control) vào ucManageStaff với mục đích edit hoặc insert thông tin nhân viên. fvStaffEdit  này được set thuộc tính visible = false. Setup datasource cho fvStaffEdit và <strong>set DataKeyNames = StaffID (field key of Staff table)</strong>, datasource này được thiết lập phương thức select(int staffid) với <strong>selectparameter staffid này được gán cho thuộc tính SelectedValue của gvStaffList</strong>. Như vậy khi gvStaffList select 1 row thì key field của row đó sẽ truyền sang cho fvStaffEdit</li>
</ol>
<p>FB tạo linkbutton trên gvStaffList  để thực thi việc editing</p>
<pre>...
&#60;asp:TemplateField&#62;
    &#60;ItemTemplate&#62;
          &#60;asp:LinkButton ID="LinkButton1" runat="server"
                 CausesValidation="false" CommandName="Edit"&#62;
              &#60;asp:Image ID="Image1" ImageUrl="~/img/reply.gif" /&#62;
          &#60;/asp:LinkButton&#62;
    &#60;/ItemTemplate&#62;
&#60;/asp:TemplateField&#62;
...</pre>
<p>Khi user click vào linkbutton trên 1 row nào đó, gvStaffList sẽ thực hiện việc select row này. Để làm điều đó ta cần xử lý sự kiện RowCommand của gvStaffList như sau:</p>
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">protected void gvStaff_RowCommand(object sender, GridViewCommandEventArgs e)
{
    // get index of row
    <span style="text-decoration:underline;">int rowIndex = Convert.ToInt32(e.CommandArgument);</span>

    switch (e.CommandName.ToLower())
    {
        case "edit":
            // set selected row is editing row
            gvStaff.SelectedIndex = rowIndex;
            // show fvStaffEdit
            // hide gvStaffList
            break;
        ....
    }
}</pre>
<p>Gặp lỗi ngay tại dòng underline đầu tiên, lỗi thông báo &#8220;Input string was not in a correct format.&#8221; !!! What&#8217;s happen??? Đó là do e.CommandArgument là empty, do vậy không thể convert to int được. <em>Chú ý: nếu bạn sử dụng CommandField thay vì dùng TemplateField với LinkButton trong gridview thì lỗi này sẽ không xảy ra bởi asp.net đã thiết lập sẵn </em><span style="font-family:verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;line-height:normal;white-space:pre-wrap;"><em>CommandArgument</em><span style="font-family:Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif;white-space:normal;line-height:19px;"><em> cho bạn</em>. Vậy how to solve it???</span></span></p>
<p>Tớ biết có 2 cách giải quyết việc này: cách 1 là bind data of StaffID field vào CommandArgument att của LinkButton control, cách 2 là dùng BindingContainer att của LinkButton trong Gridview để lấy được curent row (clicked row)</p>
<p><strong>Cách 1,</strong> ta cần sửa gvStaffList như sau:</p>
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">...
&#60;asp:TemplateField&#62;
    &#60;ItemTemplate&#62;
          &#60;asp:LinkButton ID="LinkButton1" runat="server"
                 CausesValidation="false" CommandName="Edit"
<strong>                <span style="color:#ff0000;"> CommandArgument="&#60;%#Eval(”StaffID”) %&#62;"</span></strong>&#62;
              &#60;asp:Image ID="Image1" ImageUrl="~/img/reply.gif" /&#62;
          &#60;/asp:LinkButton&#62;
    &#60;/ItemTemplate&#62;
&#60;/asp:TemplateField&#62;
...</pre>
<p>Lúc này hàm RowCommand của gvStaffList sẽ thực hiện mà không gặp lỗi.</p>
<p><strong>Cách 2, </strong>sửa hàm RowCommand của gvStaffList:</p>
<pre style="font:normal normal normal 12px/18px Consolas, Monaco, 'Courier New', Courier, monospace;">protected void gvStaff_RowCommand(object sender, GridViewCommandEventArgs e)
{
    // get index of row
    // int rowIndex = Convert.ToInt32(e.CommandArgument);

    <strong>// get command control
    if (!(e.CommandSource is LinkButton)) return;
    LinkButton link = (LinkButton)e.CommandSource;

    // Get data container of LinkButton
    GridViewRow row = (GridViewRow)link.BindingContainer;</strong>
    switch (e.CommandName.ToLower())
    {
        case "edit":
            // set selected row is editing row
            gvStaff.SelectedIndex = row.RowIndex;

            // show fvStaffEdit
            // hide gvStaffList
            break;
        ....
    }
}</pre>
<p>Chỉ có 1 công đoạn nhỏ để truyền tham số thôi nhưng nó rất quan trọng và gây khá nhiều rắc rối cho người mới bắt đầu. Hy vọng bài viết này sẽ giúp ích cho các bạn. Thanks!!!</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[How To display table in GridView: Dynamically filling data in GridView from DataTable in ASP .Net]]></title>
<link>http://indiandeve.wordpress.com/2009/11/17/how-to-display-table-in-gridview-dynamically-filling-data-in-gridview-from-datatable-in-asp-net/</link>
<pubDate>Tue, 17 Nov 2009 04:57:02 +0000</pubDate>
<dc:creator>falaque</dc:creator>
<guid>http://indiandeve.wordpress.com/2009/11/17/how-to-display-table-in-gridview-dynamically-filling-data-in-gridview-from-datatable-in-asp-net/</guid>
<description><![CDATA[I had a datatable and i needed to show in a GridView in my ASP .Net page. Following is the code whic]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I had a datatable and i needed to show in a GridView in my ASP .Net page. Following is the code which help me to do so.</p>
<div style="border:1px dashed #dddd11;background:#dddedd none repeat scroll 0 0;width:100%;padding:5px;">
<pre style="font-size:120%;">        <span style="color:#008000;">//get table to be shown in grid view;</span>
	DataTable dataTable = GetRequiredTable();
	<span style="color:#008000;">//assing table to the DataSource property of GridView</span>
	myGridView.DataSource=dataTable;
	<span style="color:#008000;">//bind data from a data source to the GridView control</span>
	myGridView.DataBind();
</pre>
</div>
<p>You can also use DataSet in place of DataTable.</p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
