Would appreciate any help.
Thanks,
Steve O...
<%
@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="EditIncidents.aspx.cs" Inherits="CIMT.Forms.EditIncidents" Title="Edit Incidents" %>
<%
@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</
asp:Content>
<
asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div>
<h3 id="Add" style="text-align:left">Edit/Update/Delete Incidents</h3>
</div>
<div>
<telerik:RadGrid ID="RadGrid2"
runat="server"
GridLines="None"
DataSourceID="SqlDataSource11"
OnPageIndexChanged="dgIncidents_PageIndexChanged"
AllowAutomaticDeletes="True"
OnItemCreated="RadGrid2_ItemCreated"
AllowAutomaticInserts="True"
AllowAutomaticUpdates="True"
AllowPaging="True"
ShowStatusBar="True"
AutoGenerateColumns="False"
Skin="Simple" >
<ValidationSettings CommandsToValidate="PerformInsert,Update, Delete" EnableValidation="true" />
<%
-- Incidents --%>
<ValidationSettings ValidationGroup="gridGroup" />
<MasterTableView runat="server"
Name="Incidents"
Caption="Incidents"
DataSourceID="SqlDataSource11"
DataKeyNames="IncidentId"
CommandItemDisplay="Top"
ExpandCollapseColumn-ButtonType="ImageButton"
ExpandCollapseColumn-CollapseImageUrl="~/Images/zoom-out-icon[1].png"
ExpandCollapseColumn-ExpandImageUrl="~/Images/zoom-in-icon[1].png"
InsertItemPageIndexAction="ShowItemOnCurrentPage" >
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<%
-- Units --%>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
CancelImageUrl="~/Images/stop-icon[1].png"
UpdateImageUrl="~/Images/accept-icon[1].png"
InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png" >
</EditColumn>
</EditFormSettings>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
CancelImageUrl="~/Images/stop-icon[1].png"
UpdateImageUrl="~/Images/accept-icon[1].png"
InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png" >
</EditColumn>
</EditFormSettings>
<DetailTables>
<telerik:GridTableView runat="server"
DataKeyNames="UnitId"
Name="Units"
Width="100%"
Caption="Units"
DataSourceID="SqlDataSource2"
BorderStyle="Solid"
BorderWidth="1px"
BorderColor="Blue"
CommandItemDisplay="Top"
ExpandCollapseColumn-ButtonType="ImageButton"
ExpandCollapseColumn-CollapseImageUrl="~/Images/zoom-out-icon[1].png"
ExpandCollapseColumn-ExpandImageUrl="~/Images/zoom-in-icon[1].png">
<ParentTableRelation>
<telerik:GridRelationFields MasterKeyField="IncidentId" DetailKeyField="IncidentId" />
</ParentTableRelation>
<ExpandCollapseColumn Visible="True"></ExpandCollapseColumn>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
CancelImageUrl="~/Images/stop-icon[1].png"
UpdateImageUrl="~/Images/accept-icon[1].png"
InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png" >
</EditColumn>
</EditFormSettings>
<Columns>
<telerik:GridDropDownColumn DataField="UnitNameId"
DataSourceID="SqlDataSource3" DropDownControlType="DropDownList"
ListTextField="UnitName" ListValueField="UnitNameId" HeaderStyle-Font-Bold="true" UniqueName="UnitNameId"
HeaderText="Unit Name">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDropDownColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
EditImageUrl="~/Images/edit-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
ButtonType="ImageButton" ImageUrl="~/Images/delete-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridButtonColumn>
</Columns>
<%
-- Unit Logs --%>
<DetailTables>
<telerik:GridTableView DataKeyNames="UnitLogId"
Name="UnitLogs"
Width="100%"
Caption="Unit Logs"
BorderStyle="Solid"
BorderWidth="1px"
DataSourceID="SqlDataSource1"
BorderColor="Blue"
CommandItemDisplay="Top"
ExpandCollapseColumn-ButtonType="ImageButton"
ExpandCollapseColumn-CollapseImageUrl="~/Images/zoom-out-icon[1].png"
ExpandCollapseColumn-ExpandImageUrl="~/Images/zoom-in-icon[1].png">
<%
-- AllowAutomaticDeletes="True"
AllowAutomaticInserts="True"
AllowAutomaticUpdates="True"
--
%>
<ParentTableRelation>
<telerik:GridRelationFields MasterKeyField="UnitId" DetailKeyField="UnitId" />
</ParentTableRelation>
<ExpandCollapseColumn Visible="True" ItemStyle-Wrap="false"></ExpandCollapseColumn>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
CancelImageUrl="~/Images/stop-icon[1].png"
UpdateImageUrl="~/Images/accept-icon[1].png"
InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png" >
</EditColumn>
</EditFormSettings>
<Columns>
<telerik:GridDropDownColumn DataField="UnitLeaderId"
DataSourceID="SqlDataSource7" DropDownControlType="DropDownList"
ListTextField="Name" ListValueField="ResourceId"
HeaderStyle-Font-Bold="true" UniqueName="UnitLeaderId" HeaderText="Unit Leader">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDropDownColumn>
<telerik:GridDateTimeColumn DataField="UnitStartDate" DataType="System.DateTime"
HeaderText="Operation Start Date" HeaderStyle-Font-Bold="true" SortExpression="UnitStartDate"
UniqueName="UnitStartDate" PickerType="DateTimePicker">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="UnitEndDate" DataType="System.DateTime"
HeaderText="Operation End Date" HeaderStyle-Font-Bold="true" SortExpression="UnitEndDate"
UniqueName="UnitEndDate" PickerType="DateTimePicker">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDateTimeColumn>
<telerik:GridHyperLinkColumn ItemStyle-Font-Bold="true" ItemStyle-ForeColor="Blue"
Text="Assignments" NavigateUrl="~/Forms/Assignments.aspx" DataNavigateUrlFields="UnitLogId"
DataNavigateUrlFormatString="~/Forms/Assignments.aspx?UnitLogId={0}">
<ItemStyle Font-Bold="True" ForeColor="Blue"></ItemStyle>
</telerik:GridHyperLinkColumn>
<telerik:GridHyperLinkColumn ItemStyle-Font-Bold="true" ItemStyle-ForeColor="Blue"
Text="Activities" NavigateUrl="~/Forms/Activities.aspx" DataNavigateUrlFields="UnitLogId"
DataNavigateUrlFormatString="~/Forms/Activities.aspx?UnitLogId={0}">
<ItemStyle Font-Bold="True" ForeColor="Blue"></ItemStyle>
</telerik:GridHyperLinkColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
EditImageUrl="~/Images/edit-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
ButtonType="ImageButton" ImageUrl="~/Images/delete-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridButtonColumn>
</Columns>
<%
-- Rosters --%>
<DetailTables>
<telerik:GridTableView runat="server"
DataKeyNames="RosterId"
Caption="Rosters"
Name="Rosters"
Width="100%"
DataSourceID="SqlDataSource4"
BorderStyle="Solid"
BorderWidth="1px"
BorderColor="Blue"
CommandItemDisplay="Top"
ExpandCollapseColumn-CollapseImageUrl="~/Images/zoom-out-icon[1].png"
ExpandCollapseColumn-ExpandImageUrl="~/Images/zoom-in-icon[1].png" >
<ParentTableRelation>
<telerik:GridRelationFields MasterKeyField="UnitLogId" DetailKeyField="UnitLogId" />
</ParentTableRelation>
<ExpandCollapseColumn ExpandImageUrl="~/Images/zoom-in-icon[1].png" CollapseImageUrl="~/Images/zoom-out-icon[1].png"></ExpandCollapseColumn>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
CancelImageUrl="~/Images/stop-icon[1].png"
UpdateImageUrl="~/Images/accept-icon[1].png"
InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png" >
</EditColumn>
</EditFormSettings>
<Columns>
<telerik:GridDropDownColumn DataField="ResourceId"
DataSourceID="SqlDataSource5" DropDownControlType="DropDownList"
ListTextField="Name" HeaderStyle-Font-Bold="true" ListValueField="ResourceId" UniqueName="ResourceId" HeaderText="Resource">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn DataField="AgencyId"
DataSourceID="SqlDataSource8" DropDownControlType="DropDownList"
ListTextField="AgencyShort" HeaderStyle-Font-Bold="true" ListValueField="AgencyId" UniqueName="AgencyId" HeaderText="Agency">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDropDownColumn>
<telerik:GridDropDownColumn DataField="CallSignId"
DataSourceID="SqlDataSource6" DropDownControlType="DropDownList"
ListTextField="CallSign" HeaderStyle-Font-Bold="true" ListValueField="CallSignId" UniqueName="CallSignId" HeaderText="Call Sign">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridDropDownColumn>
<telerik:GridBoundColumn DataField="Location" DataType="System.String"
HeaderText="Location" HeaderStyle-Font-Bold="true" SortExpression="Location" UniqueName="Location" Visible="true">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Comments" DataType="System.String"
HeaderText="Comments" HeaderStyle-Font-Bold="true" SortExpression="Comments" UniqueName="Comments" Visible="true">
<HeaderStyle Font-Bold="True"></HeaderStyle>
</telerik:GridBoundColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
EditImageUrl="~/Images/edit-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
ButtonType="ImageButton" ImageUrl="~/Images/delete-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1"></EditColumn>
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<ExpandCollapseColumn CollapseImageUrl="~/Images/zoom-out-icon[1].png"
ExpandImageUrl="~/Images/zoom-in-icon[1].png">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="IncidentId" DataType="System.Int32"
ReadOnly="True" SortExpression="IncidentId"
UniqueName="IncidentId" Visible="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="IncidentName" DataType="System.String"
SortExpression="IncidentId" UniqueName="IncidentName" HeaderText="Incident Name">
<HeaderStyle Font-Bold="True"></HeaderStyle>
<ItemStyle Width="200px" />
</telerik:GridBoundColumn>
<telerik:GridDateTimeColumn DataField="OperationStartDate"
HeaderText="Start Date" UniqueName="StartDate" PickerType="DateTimePicker">
</telerik:GridDateTimeColumn>
<telerik:GridDateTimeColumn DataField="OperationEndDate" HeaderText="End Date"
UniqueName="EndDate" PickerType="DateTimePicker">
</telerik:GridDateTimeColumn>
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton"
EditImageUrl="~/Images/edit-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridEditCommandColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn"
ButtonType="ImageButton" ImageUrl="~/Images/delete-icon[1].png" ItemStyle-HorizontalAlign="Center">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridButtonColumn>
</Columns>
<EditFormSettings>
<EditColumn InsertImageUrl="~/Images/add-icon[2].png"
EditImageUrl="~/Images/edit-icon[1].png"
CancelImageUrl="~/Images/close-icon[1].png">
</EditColumn>
</EditFormSettings>
<PagerStyle HorizontalAlign="Center" />
</MasterTableView>
</telerik:RadGrid>
</div>
<%
-- </ContentTemplate>
</asp:UpdatePanel>--
%>
<%
-- DataSources --%>
<asp:SqlDataSource ID="SqlDataSource7" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>" EnableCaching="true"
SelectCommand="select ResourceId, Name from CIMT_V_Resources order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource3" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>" EnableCaching="true"
SelectCommand="select UnitNameId, UnitName from CIMT_LU_UnitNames order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource5" runat="server" EnableCaching="true"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
SelectCommand="select ResourceId, Name from CIMT_V_Resources order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource6" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
SelectCommand="select CallSignId, CallSign from CIMT_V_CallSigns order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource8" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
SelectCommand="select AgencyId, AgencyShort from CIMT_LU_Agencies order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource9" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
SelectCommand="select distinct IncidentId, IncidentName from CIMT_T_Incidents
union select '' IncidentId, '' IncidentName from CIMT_T_Incidents order by 2">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
DeleteCommand="DELETE FROM [CIMT_T_UnitLog] WHERE [UnitLogId] = @UnitLogId"
InsertCommand="INSERT INTO [CIMT_T_UnitLog] ([UnitId], [UnitLeaderId], [UnitStartDate], [UnitEndDate]) VALUES (@UnitId, @UnitLeaderId, @UnitStartDate, @UnitEndDate)"
SelectCommand="SELECT [UnitLogId], [UnitId], [UnitLeaderId], [UnitStartDate], [UnitEndDate] FROM [CIMT_T_UnitLog] WHERE [UnitId] = @UnitId"
UpdateCommand="UPDATE [CIMT_T_UnitLog] SET [UnitLeaderId] = @UnitLeaderId, [UnitStartDate] = @UnitStartDate, [UnitEndDate] = @UnitEndDate WHERE [UnitLogId] = @UnitLogId">
<SelectParameters>
<asp:Parameter Name="UnitId" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="UnitLogId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UnitId" Type="Int32" />
<asp:Parameter Name="UnitLeaderId" Type="Int32" />
<asp:Parameter DbType="DateTime" Name="UnitStartDate" />
<asp:Parameter DbType="DateTime" Name="UnitEndDate" />
<asp:Parameter Name="UnitLogId" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="UnitId" Type="Int32" />
<asp:Parameter Name="UnitLeaderId" Type="Int32" />
<asp:Parameter DbType="DateTime" Name="UnitStartDate" />
<asp:Parameter DbType="DateTime" Name="UnitEndDate" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
DeleteCommand="DELETE FROM [CIMT_T_Units] WHERE [UnitId] = @UnitId"
InsertCommand="INSERT INTO [CIMT_T_Units] ([IncidentId], [UnitNameId]) VALUES (@IncidentId, @UnitNameId)"
SelectCommand="SELECT [UnitId], [IncidentId], [UnitNameId] FROM [CIMT_T_Units] WHERE [IncidentId] = @IncidentId"
UpdateCommand="UPDATE [CIMT_T_Units] SET [UnitNameId] = @UnitNameId WHERE [UnitId] = @UnitId">
<SelectParameters>
<asp:Parameter Name="IncidentId" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="UnitId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="IncidentId" Type="Int32" />
<asp:Parameter Name="UnitNameId" Type="Int32" />
<asp:Parameter Name="UnitId" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="IncidentId" Type="Int32" />
<asp:Parameter Name="UnitNameId" Type="Int32" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMT %>"
DeleteCommand="DELETE FROM [CIMT_T_Rosters] WHERE [RosterId] = @RosterId"
InsertCommand="INSERT INTO [CIMT_T_Rosters] ([UnitLogId], [AgencyId], [CallSignId], [ResourceId], [ContactInfo], [VehicleIdentifier], [Location], [Comments]) VALUES (@UnitLogId, @AgencyId, @CallSignId, @ResourceId, @ContactInfo, @VehicleIdentifier, @Location, @Comments)"
SelectCommand="SELECT [RosterId], [UnitLogId], [AgencyId], [CallSignId], [ResourceId], [ContactInfo], [VehicleIdentifier], [Location], [Comments] FROM [CIMT_T_Rosters] WHERE [UnitLogId] = @UnitLogId"
UpdateCommand="UPDATE [CIMT_T_Rosters] SET [AgencyId] = @AgencyId, [CallSignId] = @CallSignId, [ResourceId] = @ResourceId, [ContactInfo] = @ContactInfo, [VehicleIdentifier] = @VehicleIdentifier, [Location] = @Location, [Comments] = @Comments WHERE [RosterId] = @RosterId">
<SelectParameters>
<asp:Parameter Name="UnitLogId" Type="Int32" />
</SelectParameters>
<DeleteParameters>
<asp:Parameter Name="RosterId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UnitLogId" Type="Int32" />
<asp:Parameter Name="AgencyId" Type="Int32" />
<asp:Parameter Name="CallSignId" Type="Int32" />
<asp:Parameter Name="ResourceId" Type="Int32" />
<asp:Parameter Name="ContactInfo" Type="String" />
<asp:Parameter Name="VehicleIdentifier" Type="String" />
<asp:Parameter Name="Location" Type="String" />
<asp:Parameter Name="Comments" Type="String" />
<asp:Parameter Name="RosterId" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="UnitLogId" Type="Int32" />
<asp:Parameter Name="AgencyId" Type="Int32" />
<asp:Parameter Name="CallSignId" Type="Int32" />
<asp:Parameter Name="ResourceId" Type="Int32" />
<asp:Parameter Name="ContactInfo" Type="String" />
<asp:Parameter Name="VehicleIdentifier" Type="String" />
<asp:Parameter Name="Location" Type="String" />
<asp:Parameter Name="Comments" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource11" runat="server"
ConnectionString="<%$ ConnectionStrings:CIMTConnectionString %>"
DeleteCommand="DELETE FROM [CIMT_T_Incidents] WHERE [IncidentID] = @IncidentID"
InsertCommand="INSERT INTO [CIMT_T_Incidents] ([IncidentName], [OperationStartDate], [OperationEndDate]) VALUES (@IncidentName, @OperationStartDate, @OperationEndDate)"
SelectCommand="SELECT [IncidentID], [IncidentName], [OperationStartDate], [OperationEndDate] FROM [CIMT_T_Incidents]"
UpdateCommand="UPDATE [CIMT_T_Incidents] SET [IncidentName] = @IncidentName, [OperationStartDate] = @OperationStartDate, [OperationEndDate] = @OperationEndDate WHERE [IncidentID] = @IncidentID">
<DeleteParameters>
<asp:Parameter Name="IncidentID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="IncidentName" Type="String" />
<asp:Parameter DbType="DateTime" Name="OperationStartDate" />
<asp:Parameter DbType="DateTime" Name="OperationEndDate" />
<asp:Parameter Name="IncidentID" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="IncidentName" Type="String" />
<asp:Parameter DbType="DateTime" Name="OperationStartDate" />
<asp:Parameter DbType="DateTime" Name="OperationEndDate" />
</InsertParameters>
</asp:SqlDataSource>
</
asp:Content>
------------------------------------------------------------------------------------------------------------
using
System;
using
System.Collections;
using
System.Configuration;
using
System.Data;
using
System.Linq;
using
System.Web;
using
System.Web.Security;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Web.UI.WebControls.WebParts;
using
System.Web.UI.HtmlControls;
using
System.Xml.Linq;
using
Telerik;
using
Telerik.Web.UI;
namespace
CIMT.Forms
{
public partial class EditIncidents : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void dtUnitLogs_SelectedIndexChanged(object sender, EventArgs e)
{
// int UnitLogId = int.Parse(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["UnitLogId"].ToString());
// Session["UnitLogId"] = UnitLogId;
}
protected void dgIncidents_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
RadGrid2.CurrentPageIndex = e.NewPageIndex;
}
//protected void RadGrid2_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
//{
// if ((e.Item is GridEditFormInsertItem) && (RadGrid2.MasterTableView.IsItemInserted))
// {
// GridEditFormInsertItem insertItem = (GridEditFormInsertItem)e.Item;
// RadDateTimePicker sDate = (RadDateTimePicker)insertItem["StartDate"].Controls[0];
// sDate.SelectedDate = DateTime.Now;
// insertItem = (GridEditFormInsertItem)e.Item;
// RadDateTimePicker eDate = (RadDateTimePicker)insertItem["EndDate"].Controls[0];
// eDate.SelectedDate = DateTime.Now;
// }
//}
protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditableItem && e.Item.IsInEditMode)
{
string tabName = e.Item.OwnerTableView.Name.ToString();
GridEditableItem item;
GridDateTimeColumnEditor rdtEditor;
GridDropDownColumn ddc;
DropDownList ddl;
TableCell cell;
GridDateTimeColumn rdt;
RequiredFieldValidator validator = new RequiredFieldValidator();
validator.ErrorMessage =
"* Value Required";
item = e.Item
as GridEditableItem;
switch (tabName)
{
case "Incidents":
GridTextBoxColumnEditor tbEditor;
tbEditor = (
GridTextBoxColumnEditor)item.EditManager.GetColumnEditor("IncidentName");
cell = (
TableCell)tbEditor.TextBoxControl.Parent;
tbEditor.TextBoxControl.ID =
"IncidentName";
validator.ControlToValidate = tbEditor.TextBoxControl.ID;
cell.Controls.Add(validator);
rdtEditor = (
GridDateTimeColumnEditor)item.EditManager.GetColumnEditor("StartDate");
cell = (
TableCell)tbEditor.TextBoxControl.Parent;
rdtEditor.PickerControl.ID =
"StartDate";
validator.ControlToValidate = rdtEditor.PickerControl.ID;
cell.Controls.Add(validator);
rdtEditor = (
GridDateTimeColumnEditor)item.EditManager.GetColumnEditor("EndDate");
cell = (
TableCell)tbEditor.TextBoxControl.Parent;
rdtEditor.PickerControl.ID =
"EndDate";
validator.ControlToValidate = rdtEditor.PickerControl.ID;
cell.Controls.Add(validator);
break;
case "Units":
break;
case "UnitLogs":
break;
case "Rosters":
break;
default:
break;
}
}
}