9 Answers, 1 is accepted
0
Accepted

Princy
Top achievements
Rank 2
answered on 02 Feb 2009, 10:28 AM
Hello Prabu,
I suppose you want to validate a bound column when it is in EditMode. If that is the case, you can try out the following code, wherein I have used a RequiredFieldValidator control to validate the textbox:
aspx:
cs:
Thanks
Princy.
I suppose you want to validate a bound column when it is in EditMode. If that is the case, you can try out the following code, wherein I have used a RequiredFieldValidator control to validate the textbox:
aspx:
<telerik:GridBoundColumn UniqueName="ProductName" DataField="ProductName" HeaderText="Product Name"> |
</telerik:GridBoundColumn> |
cs:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem && e.Item.IsInEditMode) |
{ |
GridEditableItem editItem = (GridEditableItem)e.Item; |
TextBox txtbx = (TextBox)editItem["ProductName"].Controls[0]; |
txtbx.ID = "TextValidated"; |
RequiredFieldValidator reqfdvalidtr = new RequiredFieldValidator(); |
reqfdvalidtr.ID = "RequiredFieldValidator1"; |
reqfdvalidtr.ErrorMessage = "RequiredField"; |
reqfdvalidtr.ControlToValidate = "TextValidated"; |
editItem["ProductName"].Width = Unit.Pixel(100); |
editItem["ProductName"].Controls.Add(reqfdvalidtr); |
} |
} |
Thanks
Princy.
0

Prabu
Top achievements
Rank 1
answered on 02 Feb 2009, 01:18 PM
Hi Princy,
Thank u for ur reply........
I got the Solution..................
0

Prabu
Top achievements
Rank 1
answered on 02 Feb 2009, 02:02 PM
Hi Princy,
I ve another doubt .... Can we bind a detailtable inside an another detailtable in radgrid in server mode. I mean 3 level heirarchy... can u send me some examples relative to it..............
0

Princy
Top achievements
Rank 2
answered on 03 Feb 2009, 04:35 AM
Hello Prabu,
You can go through the section - 'Create hierarchical grid programmatically' in the following help document which explains in detail on creating a hierarchial grid using server-side code.
Programmatic creation
Thanks
Princy.
You can go through the section - 'Create hierarchical grid programmatically' in the following help document which explains in detail on creating a hierarchial grid using server-side code.
Programmatic creation
Thanks
Princy.
0

Prabu
Top achievements
Rank 1
answered on 05 Feb 2009, 01:01 PM
Hi Princy,
Thanks for ur previous post... I got the solution............Can u solve my latest problem im facing
Im using 2 level hierarchical grid....After clicking on add new button in mastertable view when I click on expand button in the grid I cant able to close that InitInsert mode, like vice the edit mode also...
my requirement is to do only one operation at a time
when i click on editbutton in grid, If the Initinsert mode is in open mode then it should be closed.
likewise when i click expandcollapse button, if the Initinsert mode and edit mode should be automatically closed in mastertable view
and also for detail table view
im using edit mode as Inline Mode
0

Princy
Top achievements
Rank 2
answered on 06 Feb 2009, 06:52 AM
Hello Prabu,
You can go through the following help document to understand how to switch between insert and update modes:
Switching the Insert/Updade/Regular Modes
Thanks
Princy.
You can go through the following help document to understand how to switch between insert and update modes:
Switching the Insert/Updade/Regular Modes
Thanks
Princy.
0

Prabu
Top achievements
Rank 1
answered on 06 Feb 2009, 08:17 AM
Hi Princy,
Thanks for ur Post.........
Well it works on grid very well, but how can can i do it in Detail table .......
0

Prabu
Top achievements
Rank 1
answered on 09 Feb 2009, 07:40 PM
Hi
I havent got ur reply...............
Can u please post it as soon as possible...
0

Princy
Top achievements
Rank 2
answered on 10 Feb 2009, 04:15 AM
Hello Prabu,
You can set the Name properties for the MasterTableView and the DetailTableView and check for the CommandNames for the OwnerTable based on their names as shown below:
aspx:
cs:
Thanks
Princy.
You can set the Name properties for the MasterTableView and the DetailTableView and check for the CommandNames for the OwnerTable based on their names as shown below:
aspx:
<telerik:RadGrid AllowCustomPaging="true" ID="RadGrid2" runat="server" OnItemCommand="RadGrid2_ItemCommand"> |
<MasterTableView CommandItemDisplay="Top" EditMode="InPlace" Name="Master"> |
<DetailTables> |
<telerik:GridTableView EditMode="InPlace" DataSourceID="SqlDataSource1" CommandItemDisplay="Top" Name="Detail" runat="server" > |
..... |
cs:
protected void RadGrid2_ItemCommand(object source, GridCommandEventArgs e) |
{ |
if (e.Item.OwnerTableView.Name == "Master" || e.Item.OwnerTableView.Name == "Detail") |
{ |
if (e.CommandName == RadGrid.InitInsertCommandName) |
{ |
e.Item.OwnerTableView.ClearEditItems(); |
} |
if (e.CommandName == RadGrid.EditCommandName) |
{ |
e.Item.OwnerTableView.IsItemInserted = false; |
} |
} |
Thanks
Princy.