Hi Im new to telerik and asp.net. Im trying to use a gridview and seem to have it going, but the insert and update do not work.
Can anyone give me a tip on what the problem is.
Thanks
Can anyone give me a tip on what the problem is.
Thanks
<%@ Page Title="" Language="C#" MasterPageFile="~/NestedMasterPageTemplate.master"
AutoEventWireup="true" CodeFile="TEST.aspx.cs" Inherits="Study_Abroad_TEST" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"Server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
controlid
=
"RadGrid1"
loadingpanelid
=
"RadAjaxLoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"RadGrid1"
DataSourceID
=
"SessionDataSource1"
AllowSorting
=
"True"
AutoGenerateColumns
=
"false"
AutoGenerateDeleteColumn
=
"false"
AutoGenerateEditColumn
=
"true"
AllowPaging
=
"True"
GridLines
=
"None"
runat
=
"server"
ShowFooter
=
"True"
PageSize
=
"7"
AllowAutomaticInserts
=
"True"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
MasterTableView
CommandItemDisplay
=
"Top"
DataSourceID
=
"SessionDataSource1"
DataKeyNames
=
"ProgramID"
Width
=
"700"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ProgramName"
HeaderText
=
"Program Name"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Institution"
DataField
=
"Institution"
>
</
telerik:GridBoundColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"StartDate"
HeaderText
=
"Start Date"
Visible
=
"false"
EditFormColumnIndex
=
"0"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridDateTimeColumn
DataField
=
"EndDate"
HeaderText
=
"End Date"
Visible
=
"false"
EditFormColumnIndex
=
"0"
>
</
telerik:GridDateTimeColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"Country"
DataField
=
"Country"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
HeaderText
=
"City"
DataField
=
"City"
>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
HeaderText
=
"On Campus Housing"
DataField
=
"OnCampusHousing"
Visible
=
"false"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridDropDownColumn
HeaderText
=
"Housing Type"
DataField
=
"HousingType"
ListTextField
=
"HousingType"
ListValueField
=
"HousingType"
DataSourceID
=
"SessionDataSource3"
Visible
=
"false"
>
<
ItemStyle
Width
=
"20"
/>
</
telerik:GridDropDownColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Description"
HeaderText
=
"Description"
Visible
=
"false"
>
<
EditItemTemplate
>
<
asp:TextBox
ID
=
"TextBox1"
Text='<%# Bind( "Description") %>' Columns="30" Rows="5"
TextMode="MultiLine" runat="server"></
asp:TextBox
>
</
EditItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
ColumnNumber
=
"3"
CaptionFormatString
=
"Edit details for Program {0}"
CaptionDataField
=
"ProgramName"
>
<
FormTableItemStyle
Wrap
=
"False"
></
FormTableItemStyle
>
<
FormMainTableStyle
GridLines
=
"None"
CellSpacing
=
"0"
CellPadding
=
"3"
Width
=
"100%"
/>
<
FormTableStyle
GridLines
=
"Horizontal"
CellSpacing
=
"0"
CellPadding
=
"2"
CssClass
=
"module"
Height
=
"110px"
Width
=
"100%"
/>
<
FormTableAlternatingItemStyle
Wrap
=
"False"
></
FormTableAlternatingItemStyle
>
<
EditColumn
UpdateText
=
"Update"
UniqueName
=
"EditCommandColumn1"
CancelText
=
"Cancel"
>
</
EditColumn
>
<
FormTableButtonRowStyle
HorizontalAlign
=
"Left"
CssClass
=
"EditFormButtonRow"
></
FormTableButtonRowStyle
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"True"
EnableDragToSelectRows
=
"True"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
br
/>
<
asp:SqlDataSource
ID
=
"SessionDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MIS5050DBConnectionString_General %>"
DeleteCommand="DELETE FROM [SAPrograms] WHERE [ProgramID] = @ProgramID" InsertCommand="INSERT INTO [SAPrograms] ([ProgramName], [Description], [StartDate], [EndDate], [OnCampusHousing], [HousingType], [CreateDate], [ModDate], [Country], [City], [PostalCode], [Institution]) VALUES (@ProgramName, @Description, @StartDate, @EndDate, @OnCampusHousing, @HousingType, @CreateDate, @ModDate, @Country, @City, @PostalCode, @Institution)"
SelectCommand="SELECT * FROM [SAPrograms] ORDER BY [ProgramName]" ConflictDetection="CompareAllValues"
OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [SAPrograms] SET [ProgramName] = @ProgramName, [Description] = @Description, [StartDate] = @StartDate, [EndDate] = @EndDate, [OnCampusHousing] = @OnCampusHousing, [HousingType] = @HousingType, [CreateDate] = @CreateDate, [ModDate] = @ModDate, [Country] = @Country, [City] = @City, [PostalCode] = @PostalCode, [Institution] = @Institution WHERE [ProgramID] = @ProgramID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ProgramID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Institution"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Institution"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ProgramID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_ProgramID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"original_HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Institution"
Type
=
"String"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SessionDataSource2"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MIS5050DBConnectionString_General %>"
DeleteCommand="DELETE FROM [SAPrograms] WHERE [ProgramID] = @ProgramID" InsertCommand="INSERT INTO [SAPrograms] ([ProgramName], [Description], [StartDate], [EndDate], [OnCampusHousing], [HousingType], [CreateDate], [ModDate], [Country], [City], [PostalCode], [Institution]) VALUES (@ProgramName, @Description, @StartDate, @EndDate, @OnCampusHousing, @HousingType, @CreateDate, @ModDate, @Country, @City, @PostalCode, @Institution)"
SelectCommand="SELECT * FROM [SAPrograms] ORDER BY [ProgramName]" ConflictDetection="CompareAllValues"
OldValuesParameterFormatString="original_{0}" UpdateCommand="UPDATE [SAPrograms] SET [ProgramName] = @ProgramName, [Description] = @Description, [StartDate] = @StartDate, [EndDate] = @EndDate, [OnCampusHousing] = @OnCampusHousing, [HousingType] = @HousingType, [CreateDate] = @CreateDate, [ModDate] = @ModDate, [Country] = @Country, [City] = @City, [PostalCode] = @PostalCode, [Institution] = @Institution WHERE [ProgramID] = @ProgramID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"ProgramID"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Institution"
Type
=
"String"
/>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Institution"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"ProgramID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_ProgramID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_ProgramName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Description"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_OnCampusHousing"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"original_HousingType"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_CreateDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_ModDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"original_Country"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_City"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_PostalCode"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Institution"
Type
=
"String"
/>
</
UpdateParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"SessionDataSource3"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:MIS5050DBConnectionString_General %>"
SelectCommand="SELECT DISTINCT [HousingType] FROM [SAPrograms] ORDER BY [HousingType]">
</
asp:SqlDataSource
>
</
asp:Content
>