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

insert with GridTemplateColumn

8 Answers 166 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ja
Top achievements
Rank 1
Ja asked on 04 Jul 2011, 09:17 AM
Hi,
I'm using the "Client edit with batch server update" example to make my own grid. I have a question that I haven't found the solution. How can I insert a new row using gridTemplatecolumns? I have add a command Item Template linkButton element for the inserting, but when I click on it, it is only appearing for inserting a column that is a bound one. How can I do for Inserting items using template columns?
I'm trying to work in server-side all I can.
Thanks,
Jon

8 Answers, 1 is accepted

Sort by
0
Genti
Telerik team
answered on 05 Jul 2011, 02:49 PM
Hi Ja,

Did you add an InsertItemTemplate to the GridTemplateColumn that you are creating?

The demo in our site on batch updates is implemented to perform only updates.
So, you might need to make some modification to make it work in insert scenarios.

I modified it to handle automatic inserts in EditMode="InPlace".

Find attached my solution using GridTemplateColumns and let me know if it helps.

Regards,
Genti
the Telerik team
Register for the Q2 2011 What’s New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
0
Ja
Top achievements
Rank 1
answered on 06 Jul 2011, 10:48 AM
Hi,
Thank you for your help!

I have to delete the next line: 'stringSetting.TargetControls.Add(new TargetInput(txtBox.UniqueID, true));"
in RadGrid1_ItemCreated to make  appear the textboxes. Do you know why?

Thank you very much,
ja
0
Genti
Telerik team
answered on 06 Jul 2011, 12:36 PM
Hello Ja,

Thank you for contacting us back.

I am not sure how your code looks like. However I suppose you are not setting the dynamic input setting correctly.
To do so you have to:
  1. -Your RadInputManager instance should be dynamically created on Init or Load
  2. -You need to initialize and add the InputSettings to the RadInputManager first.
  3. -You need to add RadInputManager to the Page after you have added all the InputSettings.

Hope this helps.

All the best,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ja
Top achievements
Rank 1
answered on 06 Jul 2011, 02:11 PM
Hello Genti,
Thanks again for your help!
Deleting this line works fine, so no problem. 
I have another question. How can I do for opening a new form for editing a line if I click on the edit icon, but still keep the functionallity of editing by double click as the example? Is this possible?
(I've attached a image)
Can you guide me how to proceed?

Thanks in advance,
Ja
0
Genti
Telerik team
answered on 06 Jul 2011, 03:12 PM
Hi Ja,

In this case all you need to do is to enable automatic updates in the grid definition:
AllowAutomaticUpdates="true"
And make sure that you have defined the EditItemTemplate for each of the GridTemplateColumns that you might have.

I am reattaching a modified solution that illustrates this.

All the best,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ja
Top achievements
Rank 1
answered on 06 Jul 2011, 03:59 PM
Thank very much,
This works fine!!

But what I had in my head was,  if I have a lot of columns in the DB, visulaize a few in the grid and if I click edit or Insert, to apperar like a new form with all the columns. Is this possible?
Thank very much, i really appreciate your help
gr;
Ja
0
Genti
Telerik team
answered on 07 Jul 2011, 12:01 AM
Hi Ja,

Yes, it is possible.
If you want the form to look like a window you can make the EditMode="PopUp"
depending on your need.

And then in the EditItemTemplate or InsertItemTemplate you can bind controls to other fields of the datasource that weren't displayed in the grid before.

Regards,
Genti
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Ja
Top achievements
Rank 1
answered on 07 Jul 2011, 12:23 PM
Thank you very much for your help!!!!

gr,

Jon
Tags
Grid
Asked by
Ja
Top achievements
Rank 1
Answers by
Genti
Telerik team
Ja
Top achievements
Rank 1
Share this question
or