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

Controls in EditItemTemplate

7 Answers 215 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ryan Emptage
Top achievements
Rank 1
Ryan Emptage asked on 12 Mar 2009, 09:52 AM
Hi

Can you have more than one control in the EditItemTemplate?

For example, I want a RadTextBox and RadColorPicker in the EditItemTemplate.

7 Answers, 1 is accepted

Sort by
0
Ryan Emptage
Top achievements
Rank 1
answered on 12 Mar 2009, 09:53 AM
Sorry, I forgotten to mention that I'm using in-line edit mode as well.
0
Princy
Top achievements
Rank 2
answered on 12 Mar 2009, 10:38 AM
Hello Ryan,

It is possible to add more than one control in the ItemTemplate of your TemplateColumn as shown below:
aspx:
<telerik:GridTemplateColumn UniqueName="TemplateColumn1">           
     <EditItemTemplate> 
           <telerik:RadTextBox ID="RadTextBox2" runat="server"
           </telerik:RadTextBox> 
           <telerik:RadColorPicker ID="RadColorPicker1"   runat="server" Preset="Standard"
           </telerik:RadColorPicker> 
    </EditItemTemplate> 
</telerik:GridTemplateColumn> 

-Princy.
0
Ryan Emptage
Top achievements
Rank 1
answered on 12 Mar 2009, 10:51 AM
Ok thanks Princy.

So I wrote the following code:
<EditItemTemplate> 
<telerik:RadTextBox ID="radTxtCssValue" runat="server" Text='<%# Bind("CssValue") %>' Font-Names="Verdana" Font-Size="Small"></telerik:RadTextBox> 
<telerik:RadColorPicker ID="radColorPicker" runat="server" Preset="Default" ShowIcon="true" ></telerik:RadColorPicker> 
</EditItemTemplate> 

But I can't get the color picker icon to appear next to the textbox.
It always appears below the textbox.
Also the color picker seems to be outside the RadGrid.
As shown here

Any ideas?
Thanks.
0
Shinu
Top achievements
Rank 2
answered on 12 Mar 2009, 11:21 AM
Hi Ryan,

Try setting a suitable width the for the GridTemplateColumn. And also use a try adding the controls to the EditItemTemplate as shown below.

ASPX:

<
telerik:GridTemplateColumn UniqueName="TempCol"  ItemStyle-Width="200px" HeaderStyle-Width="200px"   HeaderText="TempCol" > 
                  
                  <EditItemTemplate> 
                  <table> 
                   <tr> 
                     <td> <telerik:RadTextBox ID="radTxtCssValue" runat="server"  Font-Names="Verdana" Font-Size="Small"></telerik:RadTextBox> </td> 
                     <td> 
                     <telerik:RadColorPicker ID="radColorPicker" runat="server" Preset="Default" ShowIcon="true" ></telerik:RadColorPicker> </td> 
                   </tr> 
                  </table> 
                          
                  </EditItemTemplate> 
                </telerik:GridTemplateColumn> 


Thanks
Shinu
0
Ryan Emptage
Top achievements
Rank 1
answered on 12 Mar 2009, 11:41 AM
Hi Shinu

Thanks - its nearly there.
The color picker now appears next to the textbox - Great!
But the color picker still appears to be outside the RadGrid.
If I scroll then the rows move up/down but the color picker stays in the same position.
0
Sebastian
Telerik team
answered on 12 Mar 2009, 12:24 PM
Hello Ryan,

Can you check whether setting position: relative; for the grid data div alleviates the abnormality? I suspect that you encountered an IE issues (which does not appear under Gecko-based browsers) when an element with relative positioning (RadColorPicker) is placed inside a wrapper without relative position (RadGrid data div).

How to reference the grid data div when scrolling is enabled for the control you can see from the code snippets in this help topic (scrollArea).
 
Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ryan Emptage
Top achievements
Rank 1
answered on 12 Mar 2009, 02:48 PM
Hi Sebastian

Yes, that worked!

function GridCreated (sender, args)  
{     
    var divArea = sender.GridDataDiv;  
    divArea.style.position = "relative";  

Thank you.
Tags
Grid
Asked by
Ryan Emptage
Top achievements
Rank 1
Answers by
Ryan Emptage
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Sebastian
Telerik team
Share this question
or