﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - WebGrid Enterprise - How to edit a template grid column (ColumnType="Template") in a batch update process</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-edit-a-template-grid-column-ColumnTypeTemplate-in-a-batch-update-process/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>How to edit a template grid column (ColumnType="Template") in a batch update process</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-edit-a-template-grid-column-ColumnTypeTemplate-in-a-batch-update-process/</link><pubDate>Thu, 04 Mar 2010 22:53:05 GMT</pubDate><dc:creator>andi@intersoftpt.com</dc:creator><description>&lt;p /&gt;&lt;p style="margin-top: 10px; margin-bottom: 10px; " /&gt;
&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;Hi Nicolas,&lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;    Attached is a sample code of setting a template
DropDown with different a value in each row. Please ensure that you put the .cs
file on your App_code folder. If you has noticed, on the .aspx file, you will
see a block of commented code. When you do un-commented these block of code, in
a result, any changes in WebGrid will be counted as pending changes in
BatchUpdate. However, after you change the value, the dropdown list will be disappear.
That is a known issue and under investigation of our Developer team.  
  &lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;   This is occurred because the Template cell is being
overwritten with the function of AddPendingChanges of BatchUpdate process and
cause it to be a regular label.&lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;   I hope it helps. Thank you and have a nice day.&lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;Best Regards,&lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin-top: 7.5pt; margin-right: 0in; margin-bottom: 7.5pt; margin-left: 0in; "&gt;&lt;span style="font-family: 'lucida sans unicode', sans-serif; color: black; font-size: 9pt; "&gt;&lt;span style="font-size: 9pt; "&gt;Andi Santoso&lt;o:p /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;span style="font-size: 9pt; "&gt; &lt;/span&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style="font-size: 9pt; "&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="font-size: 9pt; "&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;o:p /&gt;&lt;/p&gt;
&lt;p /&gt;
&lt;p /&gt;</description></item><item><title>How to edit a template grid column (ColumnType="Template") in a batch update process</title><link>http://www.intersoftsolutions.com/Community/WebGrid/How-to-edit-a-template-grid-column-ColumnTypeTemplate-in-a-batch-update-process/</link><pubDate>Wed, 03 Mar 2010 12:57:26 GMT</pubDate><dc:creator>lybax</dc:creator><description>&lt;p&gt;I need to bind a different dropdown for each row in my grid in order to edit a column using this control.&lt;/p&gt;
&lt;p&gt;I cannot use EditType="WebComboNET" or EditType="DropdownList" on my column because these edit controls are the same for each row.&lt;/p&gt;
&lt;p&gt;So I need to use ColumnType="Template", EditType="NoEdit" and specify a custom asp dropdownlist in my CellTemplate that will be initilaized during InitializeRow event. &lt;/p&gt;
&lt;p&gt;This dropdown includes a client-side "onChange" event:&lt;/p&gt;&lt;pre&gt;function ddl_change(ddlClientId) 
{
    var grid = ISGetObject('&amp;lt;%= wg.ClientID %&amp;gt;');
    var row = grid.GetSelectedObject().GetRowObject(); 
    var cell = row.GetCell("MyColumn");
    var ddl = document.getElementById(ddlClientId);

    cell.SetValue(ddl.value);
    row.AddPendingChanges();
    //row.SetDataChanged();
}&lt;/pre&gt;

&lt;p&gt;I tried several possibilities in the last 3 lines.&lt;/p&gt;
&lt;p&gt;SetValue is needed for the pending changes summary and the batch update.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The problem is that this method removes&amp;nbsp;my&amp;nbsp;dropdownlist&amp;nbsp;and replaces it by a simple text&amp;nbsp;with all values from the dropdownlist.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Why is my dropdown disappearing? &lt;br /&gt;Why is the replaced text containing all my dropdown values?&lt;br /&gt;How do I set my selected value in order to perform the batch update?&lt;br /&gt;Is there another solution to do this?&lt;/p&gt;</description></item></channel></rss>