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

Open grid for insert on page load default values.

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ted
Top achievements
Rank 1
Ted asked on 28 Apr 2010, 01:44 PM

I am using a grid in my page for the user to insert data into.  on opening the page I want the grid to open the insert mode.  I put this in and it works but the default values are not showing in the fields.  if I just load the page and click on the insert link the values are there.  is there a way I can get my default values to show while opening this on the page load?

 

protected

 

void RadGrid2_PreRender(object sender, EventArgs e)

 

{

 

if (!Page.IsPostBack)

 

{

RadGrid2.MasterTableView.IsItemInserted =

true;

 

RadGrid2.Rebind();

}

}

my column editor looks like this

<

 

telerik:GridNumericColumnEditor ID="CCTavelCostColumnEditor" runat="server">

 

 

<NumericTextBox runat="server" ID="NumericTextBox3" Width="80px" Value="0" NumberFormat-DecimalDigits="0" Type="Currency"

 

 

</NumericTextBox>

 

 

</telerik:GridNumericColumnEditor>

if it helps my column is like this

 

<

 

telerik:GridNumericColumn Aggregate="Sum" DataField="TRAVELCOST" HeaderText="TRAVEL COST" UniqueName="TRAVELCOST" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right"

 

 

DataType="System.Decimal" DataFormatString="{0:C}" ColumnEditorID="CCTavelCostColumnEditor" ItemStyle-Width="80px"

 

 

 

 

 

FooterAggregateFormatString="{0:C}" FooterStyle-HorizontalAlign="Right">

 

 

 

 

 

<FooterStyle HorizontalAlign="Right"></FooterStyle>

 

 

 

 

 

<HeaderStyle HorizontalAlign="Right"></HeaderStyle>

 

 

 

 

 

<ItemStyle HorizontalAlign="Right"></ItemStyle>

 

 

 

 

 

</telerik:GridNumericColumn >

 

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 30 Apr 2010, 03:31 PM
Hello Ted,

I am not quite sure if I understand your scenario correctly. It is expected the fields to be empty when you put the grid in insert mode. Please note that when the grid is in insert mode it is expected to insert new row instead of changing the default one.
 
In case you want to force the grid items in edit mode when the grid displays initially on the page, please refer to the help article below:
Default edit mode for grid items on initial load

Greetings,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Ted
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or