This is a migrated thread and some comments may be shown as answers.

I tried to follow "Edit On Double Click" Tutorial - But GridTextBoxColumn won't work if it is set to "TextBoxMode: Multirow"

3 Answers 40 Views
Grid
This is a migrated thread and some comments may be shown as answers.
LamKhoa
Top achievements
Rank 1
LamKhoa asked on 16 Jun 2011, 11:04 PM
I tried to follow "Edit On Double Click" Tutorial:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/editondblclick/defaultcs.aspx
Everything works quite well. Except that when I changed the GridTextBoxColumnEditor to Multirow mode, it won't be tracked change anymore, (If I make some editing into this multirow textbox, and then click outside, it won't popup "Update changes!", but it works once I change the GridTextBoxColumnEditor back to "SingleLine")

I opened the Demo Project (RadControlExamples that comes with the package), and change the textbox in this project to Multirow, it won't work either.

Please let me know if there is any workaround, Thanks.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Jun 2011, 11:46 AM
Hello Lamkhoa,

I tried to replicate the same scenario and it is working fine in my end. Make sure that you have set the ColumnEditorID properly.

aspx:
<telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" DataSourceID="SqlDataSource1">
       . . . .
   <telerik:GridBoundColumn DataField="CustomerID" UniqueName="CustomerID" HeaderText="CustomerID" ColumnEditorID="GridTextBoxColumnEditor1">
   </telerik:GridBoundColumn>
       . . . .
</telerik:RadGrid>
 <telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor1" TextBoxMode="MultiLine" runat="server"  TextBoxStyle-Width="180px" />

Thanks,
Princy.
0
LamKhoa
Top achievements
Rank 1
answered on 17 Jun 2011, 03:13 PM
May you please go straight to the Demo and change the any textbox in there to MultiLine. I did that, and then it didn't work.

Thanks

John.
0
Genti
Telerik team
answered on 20 Jun 2011, 05:01 PM
Hi John,

That happens because the declaration of the textbox in the client side is shown as a textarea when the text mode is set to multiline.
So, a simple update in the javascript code would do the job:
function GridCreated(sender, eventArgs) {
               var gridElement = sender.get_element();
  
               var elementsToUse = [];
               inputs = gridElement.getElementsByTagName("input");
             //get the text areas, set the handlers on key up, then append these to the inputs array
               texts = gridElement.getElementsByTagName("textarea");
               for (var i = 0; i < texts.length; i++) {
                   texts[i].onkeyup = TrackChanges;
               }
  
               for (var i = 0; i < texts.length; i++) {
                   inputs[inputs.length] = texts[i];
               }
  
               for (var i = 0; i < inputs.length; i++) {
                   var lowerType = inputs[i].type.toLowerCase();
                   if (lowerType == "hidden" || lowerType == "button") {
                       continue;
                   }
  
                   Array.add(elementsToUse, inputs[i]);
                   inputs[i].onchange = TrackChanges;
               }
  
               dropdowns = gridElement.getElementsByTagName("select");
               for (var i = 0; i < dropdowns.length; i++) {
                   dropdowns[i].onchange = TrackChanges;
               }
  
  
               setTimeout(function () { if (elementsToUse[0]) elementsToUse[0].focus(); }, 100);
           }

Hope this helps.

All the best,
Genti
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
LamKhoa
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
LamKhoa
Top achievements
Rank 1
Genti
Telerik team
Share this question
or