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

EditFormTemplate - changing default value in textbox

2 Answers 177 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian Coetzer
Top achievements
Rank 2
Ian Coetzer asked on 03 Sep 2008, 09:12 AM
Hi

I want to know how I can change the 'default' text that appears in a textbox that I have placed in the EditFormTemplate section of my radGrid from "Telerik.Web.UI.GridInsertionObject" to something else like "(please enter a value)"

This is what I have tried so far ...
But it still populates the text of the textbox to Telerik.Web.UI.GridInsertionObject when I want to insert a new record.

        <EditFormSettings> 
            <FormTemplate> 
                <asp:TextBox ID="txtUserName" runat="server" Text="(enter a user name)"></asp:TextBox> 
            </FormTemplate> 
            <PopUpSettings ScrollBars="None" /> 
        </EditFormSettings> 

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 03 Sep 2008, 10:06 AM
Hello Ian,

Check out the following code to set values for column editors.
 protected void RadGrid1_ItemCommand(object  source, Telerik.Web.UI.GridCommandEventArgs e) 
 { 
   if (e.CommandName == RadGrid.InitInsertCommandName) 
    { 
     e.Canceled = true
 
      System.Collections.Specialized.ListDictionary newnewValues = new System.Collections.Specialized.ListDictionary(); 
      newValues["ContactName"] = "default contact name"; 
      newValues["CompanyName"] = " default company name"; 
      newValues["Country"] = "country name"; 
      newValues["Bool"] = false; 
  
      e.Item.OwnerTableView.InsertItem(newValues); 
    } 
 }  

For more information on how to set predefined values for ColumnEditors you can go through the following help document.
Inserting values in-place and EditForms

Princy.
0
Eric Schoenholzer
Top achievements
Rank 2
answered on 08 Sep 2008, 10:38 PM

Hi, desn't work for me.

For ex.:

  <telerik:GridDropDownColumn DataField="SpesenVerrechnung" DataType="System.Int32"
HeaderText="Verrechnung" DataSourceID="sqlSpesenVerrechnung" ListValueField="Id" 
ListTextField="SpesenVerrechnung" SortExpression="SpesenVerrechnung" UniqueName="SpesenVerrechnung">
<ItemStyle Wrap="False" />
</telerik:GridDropDownColumn>

  <telerik:GridDropDownColumn DataField="TaetigkeitID" DataType="System.Int32" HeaderText="Tätigkeit"
DataSourceID="sqlTaetigkeit" ListValueField="ID" ListTextField="TaetigkeitText"
SortExpression="TaetigkeitText" UniqueName="TaetigkeitID">
</telerik:GridDropDownColumn>

and with

newValues["SpesenVerrechnung"] = "Intern"

newValues["TaetigkeitID"] = "Support"

Any idea why?

Thanks

Eric

Tags
Grid
Asked by
Ian Coetzer
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Eric Schoenholzer
Top achievements
Rank 2
Share this question
or