HI,
I can't submit the form when insert and update forms are opened simultaneously . I am trying to define separate validation groups for insert and update as it explained in the following link.
But getting object reference error in the following code on PerformInsertButton and UpdateButton.
protected void RadGridFilePlanCEDMSFunctional_ItemCreated(object sender, GridItemEventArgs e){
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
var rvValue = (RequiredFieldValidator)e.Item.FindControl("RadCboRetentionGracePeriodMonthValidator");
if (e.Item is GridEditFormInsertItem)
{
rvValue.ValidationGroup = "addRowValidation";
((e.Item as GridEditFormItem).FindControl("PerformInsertButton") as LinkButton).ValidationGroup = "FunctionalAddRowValidation";
}
else
{
rvValue.ValidationGroup = "editRowValidation";
((e.Item as GridEditFormItem).FindControl("UpdateButton") as LinkButton).ValidationGroup = "FunctionalEditRowValidation";
}
}
}
Edit form template html is defined as follows...any help will be appreciated!
<%--EDIT MODE Controls--%><EditFormSettings EditFormType="Template">
<FormTemplate>
<table id="Table2" style="width: 100%; border-spacing: 2px; padding: 2px; border: 1px; border-collapse: collapse" class="table">
<tr style="height: 10px">
<td colspan="3"></td>
</tr>
<tr>
<td style="width: 60px"></td>
<td>
<table id="Table3" style="width: 450px; border: 0px;">
<tr>
<td style="vertical-align: middle">
<asp:Label ID="lblDocumentType" runat="server">Document Type:</asp:Label>
</td>
<td>
<telerik:RadComboBox ID="RadCboDocumentType" runat="server" RenderMode="Lightweight" Width="250px" Visible="true" TabIndex="1"
DataSourceID="dsDocumentTypes" DataTextField="DocumentTypename" DataValueField="DocumentTypeId"
EmptyMessage="Select DocumentType" SelectedValue='<%# Bind("DocumentTypeId") %>'>
</telerik:RadComboBox>
<br />
</td>
</tr>
<tr style="height: 5px">
<td colspan="2"></td>
</tr>
<tr>
<td style="vertical-align: middle">
<asp:Label ID="lblSite" runat="server">Site:</asp:Label>
</td>
<td>
<telerik:RadComboBox ID="RadCboSite" runat="server" RenderMode="Lightweight" Width="250px" Visible="true" TabIndex="2"
DataSourceID="dsSites" DataTextField="SiteName" DataValueField="SiteId"
EmptyMessage="Select Site" SelectedValue='<%# Bind("SiteId") %>'>
</telerik:RadComboBox>
<br />
</td>
</tr>
<tr style="height: 5px">
<td colspan="2"></td>
</tr>
<tr>
<td style="vertical-align: middle">
<asp:Label ID="lblRetYear" runat="server">Retention Year:</asp:Label>
</td>
<td>
<telerik:RadComboBox ID="RadCboRetentionYear" runat="server" RenderMode="Lightweight" Width="250px" TabIndex="3"
DataSourceID="dsRetentionYear" DataTextField="RetentionYear" SelectedValue='<%# Bind("RetentionYear") %>'
DataValueField="RetentionYear" EmptyMessage="Select Year">
</telerik:RadComboBox>
<br />
</td>
</tr>
<tr style="height: 5px">
<td colspan="2"></td>
</tr>
<tr>
<td style="vertical-align: middle">
<asp:Label ID="lblRetMonth" runat="server">Retention Month:</asp:Label>
</td>
<td>
<telerik:RadComboBox ID="RadCboRetentionMonth" runat="server" RenderMode="Lightweight" Width="250px" TabIndex="4"
DataSourceID="dsRetentionMonth" DataTextField="RetentionMonth" SelectedValue='<%# Bind("RetentionMonth") %>'
DataValueField="RetentionMonth" EmptyMessage="Select Month">
</telerik:RadComboBox>
<br />
</td>
</tr>
</table>
</td>
<td>
<table id="Table1" style="padding: 1px; border-spacing: 1px; border: 0px;">
<tr>
<td style="vertical-align: middle">
<asp:Label ID="lblRetGPMonth" runat="server">Retention Grace Period Month:</asp:Label>
</td>
<td>
<telerik:RadComboBox ID="RadCboRetentionGracePeriodMonth" runat="server" RenderMode="Lightweight" Width="268px" TabIndex="5"
DataSourceID="dsRetentionGracePeriodMonth" DataTextField="RetentionGracePeriodMonth" SelectedValue='<%# Bind("RetentionGracePeriodMonth") %>'
DataValueField="RetentionGracePeriodMonth" EmptyMessage="Select Month" >
</telerik:RadComboBox>
<br />
<asp:RequiredFieldValidator ID="RadCboRetentionGracePeriodMonthValidator" ControlToValidate="RadCboRetentionGracePeriodMonth"
runat="server" ErrorMessage="Retention Grace Period Month is a required field" Display="Dynamic"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr style="height: 5px">
<td colspan="2"></td>
</tr>
<tr style="height: 5px">
<td colspan="2"></td>
</tr>
<tr>
<td style="vertical-align: top">
<asp:Label ID="lblComments" runat="server">Comments:</asp:Label>
</td>
<td>
<telerik:RadTextBox ID="RadTextBox" runat="server" TextMode="MultiLine" Rows="6" Columns="40" Wrap="true"
MaxLength="250" Text='<%# Bind("Comments") %>'>
</telerik:RadTextBox>
</td>
</tr>
</table>
</td>
</tr>
<tr style="height: 10px">
<td colspan="3"></td>
</tr>
<tr>
<td style="width: 60px"></td>
<td style="text-align: center;" colspan="2">
<telerik:RadButton RenderMode="Lightweight" ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</telerik:RadButton>
<telerik:RadButton RenderMode="Lightweight" ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
CommandName="Cancel">
</telerik:RadButton>
</td>
</tr>
<tr style="height: 10px">
<td colspan="3"></td>
</tr>
<tr>
<td style="width: 60px"></td>
<td class="insideHeader" colspan="2"></td>
</tr>
<tr style="height: 10px">
<td colspan="3"></td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
any response please?