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

Problem with GridTemplateColumn

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mww
Top achievements
Rank 1
mww asked on 28 Sep 2009, 12:47 PM
I want to have a multi line text box in my grid, heres how Ive done it

<telerik:GridTemplateColumn UniqueName="TickerColumn" HeaderText="Ticker Text">  
                          
                        <ItemTemplate> 
                            <%#DataBinder.Eval(Container.DataItem,"TickerContent")%> 
                        </ItemTemplate> 
                        <EditItemTemplate> 
                            <telerik:RadTextBox ID="RadTextBoxTickerContent" runat="server" TextMode="MultiLine" MaxLength="500" Rows="5" Width="350px">  
                            </telerik:RadTextBox> 
                              
                        </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
 
in the insert method I have this code

protected void RadGridTicker_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)  
        {  
              
 
            Telerik.Web.UI.GridEditFormInsertItem insertedItem = (Telerik.Web.UI.GridEditFormInsertItem)e.Item;  
 
            RadComboBox cbPage = (e.Item as GridEditableItem)["ddlDisplayPage"].Controls[0] as RadComboBox;  
            Telerik.Web.UI.RadTextBox tbContent = (insertedItem.FindControl("RadTextBoxTickerContent") as Telerik.Web.UI.RadTextBox);     
 
 
              
            string content = tbContent.Text;  
 
            string res = tickermanager.Add(cbPage.SelectedValue, content);  
 
            if (!string.IsNullOrEmpty(res))  
            {  
                this.RadGridTicker.Controls.Add(new LiteralControl("Unable to insert ticker. Reason: " + res));  
                e.Canceled = true;  
            }  
        } 

stepping through the code shows that an instance of the text box is created, but the text property is null  even though ive typed in several lines of text.  What am I doing wrong here ?

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 30 Sep 2009, 02:58 PM
Hi Mark,

I am afraid I am unable to replicate the described by you issue. Please take a look at the attached project using your code which gets the value of the text box correct. Let me know what differs in your case.

Best wishes,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
mww
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or