<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Data Presentation Controls</title><link>http://forums.asp.net/24.aspx</link><description>ASP.NET data-bound controls such as the DataGrid, DataList, GridView, FormView, DetailsView, and Repeater Controls.  &lt;a href="http://aspadvice.com/SignUp/list.aspx?l=23&amp;c=17" target="_blank"&gt;Email List&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3550163.aspx</link><pubDate>Sun, 06 Dec 2009 09:01:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3550163</guid><dc:creator>davidfowl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3550163.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3550163</wfw:commentRss><description>&lt;p&gt;Just so everyone knows. We&amp;#39;ve made a fix in ASP.NET 4.0 so you &lt;b&gt;*will*&lt;/b&gt;&amp;nbsp;get the data without using a datasource and without the need for the helpers I blogged about.&lt;/p&gt;&lt;p&gt;Hope that makes you all happy. &lt;img src="http://forums.asp.net/tiny_mce/jscripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif" alt="Laughing" title="Laughing" border="0" /&gt;&lt;/p&gt;&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3422570.aspx</link><pubDate>Thu, 24 Sep 2009 08:33:29 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3422570</guid><dc:creator>sandy060583</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3422570.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3422570</wfw:commentRss><description>&lt;p&gt;@@@ Very Userful @@@&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3311400.aspx</link><pubDate>Fri, 24 Jul 2009 14:44:39 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3311400</guid><dc:creator>dministrator</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3311400.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3311400</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Wow. Dave, that worked and the depth of your knowledge&amp;nbsp;is&amp;nbsp;amazing. Thank you very much.&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3309935.aspx</link><pubDate>Thu, 23 Jul 2009 19:57:27 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3309935</guid><dc:creator>davidfowl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3309935.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3309935</wfw:commentRss><description>&lt;p&gt;The controls in your &lt;strong&gt;EditItemTemplate&lt;/strong&gt; need to have the &amp;lt;%# Bind(&amp;quot;PropertyName&amp;quot;) %&amp;gt; &lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3309918.aspx</link><pubDate>Thu, 23 Jul 2009 19:47:12 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3309918</guid><dc:creator>dministrator</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3309918.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3309918</wfw:commentRss><description>&lt;pre class="xhtml:showcolumns" name="code"&gt;Here is my grid. Thank you for taking time to look into this: &lt;/pre&gt;&lt;pre class="xhtml:showcolumns" name="code"&gt;     &amp;lt;asp:GridView ID=&amp;quot;GridView1&amp;quot; runat=&amp;quot;server&amp;quot; AllowPaging=&amp;quot;True&amp;quot; AllowSorting=&amp;quot;True&amp;quot;
                    AutoGenerateColumns=&amp;quot;False&amp;quot; DataKeyNames=&amp;quot;ProductID&amp;quot; OnRowCancelingEdit=&amp;quot;GridView1_RowCancelingEdit&amp;quot;
                    OnRowEditing=&amp;quot;GridView1_RowEditing&amp;quot; OnRowDeleting=&amp;quot;GridView1_RowDeleting&amp;quot; OnRowUpdating=&amp;quot;GridView1_RowUpdating&amp;quot;
                    OnRowCommand=&amp;quot;GridView1_RowCommand&amp;quot; onsorting=&amp;quot;GridView1_Sorting&amp;quot;&amp;gt;
                    &amp;lt;Columns&amp;gt;
                        &amp;lt;asp:CommandField HeaderText=&amp;quot;Delete&amp;quot; ShowDeleteButton=&amp;quot;true&amp;quot; ShowHeader=&amp;quot;true&amp;quot; /&amp;gt;
                        &amp;lt;asp:TemplateField&amp;gt;
                            &amp;lt;EditItemTemplate&amp;gt;
                                &amp;lt;asp:LinkButton ID=&amp;quot;btnEdit&amp;quot; runat=&amp;quot;server&amp;quot; CommandName=&amp;quot;Update&amp;quot; Text=&amp;quot;Update&amp;quot; CausesValidation=&amp;quot;true&amp;quot; /&amp;gt;
                                &amp;lt;asp:LinkButton ID=&amp;quot;btnCancel&amp;quot; runat=&amp;quot;server&amp;quot; CommandName=&amp;quot;Cancel&amp;quot; Text=&amp;quot;Cancel&amp;quot; /&amp;gt;
                            &amp;lt;/EditItemTemplate&amp;gt;
                            &amp;lt;ItemTemplate&amp;gt;
                                &amp;lt;asp:LinkButton ID=&amp;quot;btnEdit&amp;quot; runat=&amp;quot;server&amp;quot; CommandName=&amp;quot;Edit&amp;quot; Text=&amp;quot;Edit&amp;quot; /&amp;gt;
                            &amp;lt;/ItemTemplate&amp;gt;
                        &amp;lt;/asp:TemplateField&amp;gt;
                        &amp;lt;asp:TemplateField HeaderText=&amp;quot;Name&amp;quot; SortExpression=&amp;quot;Name&amp;quot;&amp;gt;
                            &amp;lt;EditItemTemplate&amp;gt;
                                &amp;lt;asp:TextBox ID=&amp;quot;txtName&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%# Eval(&amp;quot;Name&amp;quot;) %&amp;gt;&amp;#39;&amp;gt;                  
                                &amp;lt;/asp:TextBox&amp;gt;
                            &amp;lt;/EditItemTemplate&amp;gt;
                            &amp;lt;ItemTemplate&amp;gt;
                                &amp;lt;asp:Label ID=&amp;quot;lblName&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%#Bind(&amp;quot;Name&amp;quot;) %&amp;gt;&amp;#39;&amp;gt;&amp;lt;/asp:Label&amp;gt;
                            &amp;lt;/ItemTemplate&amp;gt;
                        &amp;lt;/asp:TemplateField&amp;gt;
                        &amp;lt;asp:TemplateField HeaderText=&amp;quot;Product Number&amp;quot; SortExpression=&amp;quot;ProductNumber&amp;quot;&amp;gt;
                            &amp;lt;ItemTemplate&amp;gt;
                                &amp;lt;asp:Label ID=&amp;quot;lblProductNumber&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%#Bind(&amp;quot;ProductNumber&amp;quot;) %&amp;gt;&amp;#39; /&amp;gt;
                            &amp;lt;/ItemTemplate&amp;gt;
                        &amp;lt;/asp:TemplateField&amp;gt;
                        &amp;lt;asp:TemplateField HeaderText=&amp;quot;ListPrice&amp;quot; SortExpression=&amp;quot;ListPrice&amp;quot;&amp;gt;
                            &amp;lt;ItemTemplate&amp;gt;
                                &amp;lt;asp:Label ID=&amp;quot;lblListPrice&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%#Bind(&amp;quot;ListPrice&amp;quot;) %&amp;gt;&amp;#39; /&amp;gt;
                            &amp;lt;/ItemTemplate&amp;gt;
                        &amp;lt;/asp:TemplateField&amp;gt;
                    &amp;lt;/Columns&amp;gt;
                &amp;lt;/asp:GridView&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3309899.aspx</link><pubDate>Thu, 23 Jul 2009 19:37:54 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3309899</guid><dc:creator>davidfowl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3309899.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3309899</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thats weird, the row state for the row should be edit since your passing in the EditRow. Maybe try tweaking the source&amp;nbsp;and hardcoding the row state to be edit instead of passing it in from the row.&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;public static IDictionary GetValues(GridViewRow row) {
    IOrderedDictionary values = new OrderedDictionary();
    foreach (DataControlFieldCell cell in row.Cells) {
        if (cell.Visible) {
            // Extract values from the cell
            cell.ContainingField.ExtractValuesFromCell(values, cell, DataControlRowState.Edit, true);
        }
    }
    return values;
} 
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Can you maybe show more of your grid?&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3309858.aspx</link><pubDate>Thu, 23 Jul 2009 19:19:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3309858</guid><dc:creator>dministrator</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3309858.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3309858</wfw:commentRss><description>&lt;p&gt;Dave&amp;gt;&amp;gt; When I do this, in edit mode,&amp;nbsp;the IDictionary object returned by the GetValues function contains only the Non-editable items. In this case, the dictionary contains ProductNumber and List price, both of which are non editable.&amp;nbsp;The product name which now is&amp;nbsp;in editable mode is not available in the dictionary.&amp;nbsp; Why is this and how do I ensure it is returned by the GetValues function in the IDictionary object?&lt;br /&gt;&lt;br /&gt;Forgive me please if this is very primitive. Thank you.&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3308627.aspx</link><pubDate>Wed, 22 Jul 2009 22:31:55 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3308627</guid><dc:creator>davidfowl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3308627.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3308627</wfw:commentRss><description>&lt;p&gt;You would call GetValues on the GridViewRow being edited.&lt;/p&gt;&lt;pre class="c-sharp" name="code"&gt;protected void RowUpdating(object sender, GridViewUpdateEventArgs e) {
    IDictionary values = GetValues(GridView1.Rows[e.RowIndex]);
    // Do something with the values here
}
&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;Hope this helps.&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3308546.aspx</link><pubDate>Wed, 22 Jul 2009 21:34:50 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3308546</guid><dc:creator>dministrator</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3308546.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3308546</wfw:commentRss><description>&lt;p&gt;&lt;strong&gt;kraznodar&amp;nbsp;:&lt;/strong&gt;&amp;nbsp;&amp;quot;&lt;em&gt;Do we need to add your helper to our code manually and if so where and how do we trigger it?&lt;/em&gt;&amp;quot;&lt;br /&gt;&lt;strong&gt;DavidFowler:&lt;/strong&gt;&amp;nbsp;&amp;quot;&lt;em&gt;Most data controls support writing custom commands and handling some Command event(RowCommand for GridView). This method would come in handy if you needed to get the values out of the GridView for some custom command you wanted to execute. &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;If you can, use 2 way databinding, if your control doesn&amp;#39;t have&amp;nbsp;a useful&amp;nbsp;property to bind against and you need to do some more logic to get the right value then use FindControl.&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;I have a simple GridView that has three visible data columns (Product Name, Product Number, List Price from AdventureWorks Product table) and two command (Edit/Cancel and Delete)columns; the id column is invisible; only ProductName column is editable in Edit mode; it is a text box in edit mode.&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;The markup for ProductName is as follows:&lt;/p&gt;&lt;pre name="code"&gt;  &amp;lt;asp:TemplateField HeaderText=&amp;quot;Name&amp;quot; SortExpression=&amp;quot;Name&amp;quot;&amp;gt;
                            &amp;lt;EditItemTemplate&amp;gt;
                                &amp;lt;asp:TextBox ID=&amp;quot;txtName&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%# Eval(&amp;quot;Name&amp;quot;) %&amp;gt;&amp;#39;&amp;gt;                  
                                &amp;lt;/asp:TextBox&amp;gt;
                            &amp;lt;/EditItemTemplate&amp;gt;
                            &amp;lt;ItemTemplate&amp;gt;
                                &amp;lt;asp:Label ID=&amp;quot;lblName&amp;quot; runat=&amp;quot;server&amp;quot; Text=&amp;#39;&amp;lt;%#Bind(&amp;quot;Name&amp;quot;) %&amp;gt;&amp;#39;&amp;gt;&amp;lt;/asp:Label&amp;gt;
                            &amp;lt;/ItemTemplate&amp;gt;
                        &amp;lt;/asp:TemplateField&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Now i&amp;#39;m a newbie, so pardon me for asking this: Given the above markup, is using FindControl in RowUpdating Event of the GridView not appropriate in this case? &lt;pre&gt;&lt;/pre&gt;&amp;nbsp; &lt;pre&gt;&lt;/pre&gt;If so, can Dave or anyone who had the benefit of Dave&amp;#39;s article, please post a code to call Dave&amp;#39;s GetValues fuction in this case? &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;/pre&gt;Many Thanks for anyone who can helpout a newbie. &lt;pre&gt;&lt;/pre&gt;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3201396.aspx</link><pubDate>Mon, 01 Jun 2009 08:48:56 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3201396</guid><dc:creator>lak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3201396.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3201396</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi ,&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thank you very much .Pls disregard my last reply.I have resolved it&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3201371.aspx</link><pubDate>Mon, 01 Jun 2009 08:39:05 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3201371</guid><dc:creator>lak</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3201371.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3201371</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Hi,&lt;/p&gt;&lt;p&gt;&amp;nbsp;I have changed the e.EditIndex=-1 before grid databind that worked.The first edit operation is successful but any edit after that on any record throws failed to load viewstate error &lt;/p&gt;&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;i&gt;&lt;i&gt;Failed to load viewstate. &amp;nbsp;The control tree into which
viewstate is being loaded must match the control tree that was used to
save viewstate during the previous request. &amp;nbsp;For example, when adding
controls dynamically, the controls added during a post-back must match
the type and position of the controls added during the initial request.&lt;/i&gt;&lt;/i&gt;&lt;/h2&gt;&lt;p&gt;Is there any work around for this or am i missing something&amp;nbsp;&lt;/p&gt;&lt;p&gt;Thanks for the help &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/3005974.aspx</link><pubDate>Fri, 13 Mar 2009 23:09:24 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:3005974</guid><dc:creator>BreckenridgeReal</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/3005974.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=3005974</wfw:commentRss><description>&lt;p&gt;I&amp;#39;m going to keep this in mind next time I need to get the value out of datacontrol. Thank you.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/2998984.aspx</link><pubDate>Wed, 11 Mar 2009 08:56:15 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2998984</guid><dc:creator>digish</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2998984.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=2998984</wfw:commentRss><description>&lt;p&gt;Thanks&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/2989589.aspx</link><pubDate>Sat, 07 Mar 2009 13:14:28 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2989589</guid><dc:creator>tweaver60</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2989589.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=2989589</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;Thanks David - now that&amp;#39;s some great support!&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: Getting Data out of your DataControls</title><link>http://forums.asp.net/thread/2989293.aspx</link><pubDate>Sat, 07 Mar 2009 08:41:57 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2989293</guid><dc:creator>davidfowl</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2989293.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=24&amp;PostID=2989293</wfw:commentRss><description>&lt;p&gt;I&amp;#39;ve updated the blog with code for FormView. Let me know if you have any problems. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>