We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Default Values for new records

Thread ID:

Created:

Updated:

Platform:

Replies:

49598 Sep 21,2006 03:53 PM UTC Nov 23,2006 01:13 AM UTC ASP.NET Web Forms (Classic) 6
loading
Tags: Grouping
Mitch Howell
Asked On September 21, 2006 03:53 PM UTC

When adding a new record, is there any way to have certain fields come up with a default value?

Administrator [Syncfusion]
Replied On September 22, 2006 06:51 AM UTC

Hi Mitch,

We are looking in to this and will get back to you soon.

Thanks,
A.Sivakumar

Administrator [Syncfusion]
Replied On October 9, 2006 04:45 PM UTC

Hi Mitch,

I apologize, for the delay in getting back to you, We didn''t noticed this as unanswedred because of posted in the Grouping.Web Category, and you can acheive this behavior by handling the ''QueryCellStyleInfo'' Event.

The below code indicates specifying ''new value'' for the id column for the ''AddNew'' Row.

[c#]

protected void GGC_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AddNewRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "id")
{
e.Style.Text = "newID";
}
}
}

Let us know if you need more info

Thanks,
A.Sivakumar

Administrator [Syncfusion]
Replied On October 9, 2006 04:45 PM UTC

Hi Mitch,

I apologize, for the delay in getting back to you, We didn''t noticed this as unanswedred because of posted in the Grouping.Web Category, and you can acheive this behavior by handling the ''QueryCellStyleInfo'' Event.

The below code indicates specifying ''new value'' for the id column for the ''AddNew'' Row.

[c#]

protected void GGC_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.TableCellType == GridTableCellType.AddNewRecordFieldCell)
{
if (e.TableCellIdentity.Column.Name == "id")
{
e.Style.Text = "newID";
}
}
}

Let us know if you need more info

Thanks,
A.Sivakumar

Minh Tran
Replied On November 2, 2006 06:08 PM UTC

This seems like a very awkward way of handling default values. And the QueryCellStyleInfo event fires alot.

I tried to achieve this by setting the GridStyleInfo.Text property, but it blows up in the designer & when I try to run it.

Ie, I have a GridColumnDescriptor with the following:

GridColumnDescriptor2.Appearance.AddNewRecordFieldCell.CellType = "CheckBox";

GridColumnDescriptor2.Appearance.AddNewRecordFieldCell.Text = "True";

The designer shows an object reference not set to an instance of object NullReference exception.

Any idea why this wouldn't work?

Administrator [Syncfusion]
Replied On November 4, 2006 11:59 AM UTC

Hi Minh,

We are looking in to this and will get back to you as soon as possible.

Thanks,
A.sivakumar

Administrator [Syncfusion]
Replied On November 23, 2006 01:13 AM UTC

Hi Minh,

I apologize for the delay in getting back to you. Setting the CellTypes using Celltype of the columns will result in some erorrs in design time and also you will not have a option to handle this checkbox events easily. There will be more changes and modifications in our celltypes in first quarter of 2007. For now you can acheive similar behavior through templates easily.

You can place a checkbox control as ItemTemplate or EditItemTemplate inside the corresponding column, and can set this checkbox value to true or false.

Please have a look at this forum where, checkbox inside unbound columns are discussed, Checkbox inside Grid various scenarios. You can also use bounded column for this purpose.

let us know if you have any queries.

Best regards,
Siva

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;