protected
void RadGridEmpType_InsertCommand(object source, GridCommandEventArgs e)
{
GridEditFormInsertItem insertedItem = (GridEditFormInsertItem)e.Item;
Hashtable newValues = new Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, insertedItem);
int value = 0;
RadTextBox txt = (RadTextBox)e.Item.FindControl("txtTypeShortDesc");
int Rowcount = RadGridEmpType.Items.Count;
for (int count = 0; Rowcount > count; count++)
{
Label lbl = (Label)RadGridEmpType.Items[count].FindControl("LblTypeShortDesc");
if (txt.Text.ToUpper() == lbl.Text.ToUpper())
{
value++;
}
}
if (value == 0)
{
dsiSmartEmpType.InsertParameters[0].DefaultValue = CompanyID.ToString();
dsiSmartEmpType.InsertParameters[1].DefaultValue = UserId;
}
else
{
Label lbl = (Label)e.Item.FindControl("Msg");
lbl.Text =
"Already Exists";
e.Canceled =
true;
}
}
It works.
But It just takes the record in the current page.
For example the grid contains 25 records. and the page size is given as 10.
While inserting it just checks the last five.
Is there any option to take all the 25 records in the grid.
Thank You.
-Anto
| .twocolright { |
| float:rightright; |
| padding:10px 10px 20px 5px; |
| width:75%; |
| } |
| body { |
| margin:0; |
| padding:0; |
| border:0; /* This removes the border around the viewport in old versions of IE */ |
| outline: 0; |
| width:100%; |
| background: transparent; |
| min-width:960px; |
| } |
| <telerik:RadComboBox ID="drpObjects" runat="server" AutoPostBack="true" Skin="Vista" AllowCustomText="false" |
| DropDownWidth="350px" Height="250px"> |
| <CollapseAnimation Type="InQuint" Duration="200" /> |
| <ExpandAnimation Type="OutQuint" Duration="200" /> |
| <ItemTemplate> |
| <table style="border-bottom: 1px dotted #dfdfdf; margin-bottom: 10px; font-size: 11px;" |
| width="98%"> |
| <tr> |
| <td> |
| <%#DataBinder.Eval(Container.DataItem, "LineItemID")%> |
| </td> |
| <td> |
| <%#DataBinder.Eval(Container.DataItem, "Description")%> |
| </td> |
| </tr> |
| </table> |
| </ItemTemplate> |
| </telerik:RadComboBox> |
| Namespace Entities |
| Public Class CostCenterObject |
| Inherits BaseDataEntity |
| Private _LineItemID As Integer = 0 |
| Private _Description As String = "" |
| Private _CategoryID As Integer = 0 |
| Private _ReviewOnly As Boolean |
| Private _CreateDate As DateTime |
| Private _CreateBy As String = "" |
| Private _ModifyDate As DateTime |
| Private _ModifyBy As String = "" |
| Private _Active As Boolean |
| Private _Category As String = "" |
| Private _CategoryGroupName As String = "" |
| Public ReadOnly Property LineItemID() As Integer |
| Get |
| Return _LineItemID |
| End Get |
| End Property |
| Public ReadOnly Property Description() As String |
| Get |
| Return _Description |
| End Get |
| End Property |
| Public ReadOnly Property CategoryID() As Integer |
| Get |
| Return _CategoryID |
| End Get |
| End Property |
| Public ReadOnly Property ReviewOnly() As Boolean |
| Get |
| Return _ReviewOnly |
| End Get |
| End Property |
| Public ReadOnly Property CreateDate() As DateTime |
| Get |
| Return _CreateDate |
| End Get |
| End Property |
| Public ReadOnly Property CreateBy() As String |
| Get |
| Return _CreateBy |
| End Get |
| End Property |
| Public ReadOnly Property ModifyDate() As DateTime |
| Get |
| Return _ModifyDate |
| End Get |
| End Property |
| Public ReadOnly Property ModifyBy() As String |
| Get |
| Return _ModifyBy |
| End Get |
| End Property |
| Public ReadOnly Property Active() As Boolean |
| Get |
| Return _Active |
| End Get |
| End Property |
| Public ReadOnly Property Category() As String |
| Get |
| Return _Category |
| End Get |
| End Property |
| Public ReadOnly Property CategoryGroupName() As String |
| Get |
| Return _CategoryGroupName |
| End Get |
| End Property |
| End Class |
| ' Instantiation code omitted... |
| End Namespace |
| Dim Objects As List(Of CostCenterObject) |
| Objects = _AppController.GetAvailableObjects(drpYear.SelectedValue) |
| drpObjects.DataSource = Objects |
| drpObjects.DataBind() |
| drpObjects.Items.Insert(0, New RadComboBoxItem("- ALL -", "- ALL -")) |
| <telerik:RadChart ID="RadChartQuestion" runat="server" DefaultType="Pie" Width="550px" AutoTextWrap="true" |
| OnItemDataBound="RadChart2_ItemDataBound" Skin="Office2007" Height="250px" UseSession="false" |
| TempImagesFolder = "/Tmp" > |
| <Appearance Dimensions-Width="750px"></Appearance> |
| <Series> |
| <telerik:ChartSeries Name="Series 1" Type="Pie" DataYColumn="COUNTER" |
| Appearance-EmptyValue-FillStyle-GammaCorrection="true" |
| Appearance-FillStyle-MainColor="Red" > |
| <Appearance LegendDisplayMode="ItemLabels" TextAppearance-MaxLength="100"></Appearance> |
| </telerik:ChartSeries> |
| </Series> |
| </telerik:RadChart> |