Morning,
I have a problem with the delete command on my radgrid. I was getting the error that there was null values and i needed to change "ConflictDetection" to OverwriteChanges". However this problem seems to been fixed by changing many of the Eval() bindings to Bind().
I have some binding in the grid that happens programmatically also.
Now when i hit delete, it attempts to process the command and refreshes the grid and the items remains. No error, it just does not delete the row from the SQLDataSource.
Any help would be greatly appreciated.
I have a problem with the delete command on my radgrid. I was getting the error that there was null values and i needed to change "ConflictDetection" to OverwriteChanges". However this problem seems to been fixed by changing many of the Eval() bindings to Bind().
I have some binding in the grid that happens programmatically also.
Now when i hit delete, it attempts to process the command and refreshes the grid and the items remains. No error, it just does not delete the row from the SQLDataSource.
Any help would be greatly appreciated.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Globalization;
using
Telerik.Web.UI;
using
System.Data;
public
partial
class
Admin_WriteUps : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
GridSortExpression expression =
new
GridSortExpression();
expression.FieldName =
"DateAdded"
;
expression.SetSortOrder(
"Descending"
);
RadGrid1.MasterTableView.SortExpressions.AddSortExpression(expression);
}
}
#region Validator Methods
protected
void
CustomValidator1_ServerValidate(
object
source, ServerValidateEventArgs args)
{
DateTime inputdate =
new
DateTime();
if
(args.Value.Length > 0)
{
if
(DateTime.TryParseExact(args.Value,
"M/d/yyyy"
, DateTimeFormatInfo.InvariantInfo, DateTimeStyles.None,
out
inputdate))
{
args.IsValid =
true
;
}
else
{
args.IsValid =
false
;
}
}
else
{
args.IsValid =
false
;
}
}
#endregion
protected
void
RadGrid1_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
Label InsLabel = item.FindControl(
"InsLabel"
)
as
Label;
if
(InsLabel !=
null
)
{
DataView Insurance_DataView = (DataView)Insurance_DataSource.Select(DataSourceSelectArguments.Empty);
int
indx = 0;
if
(Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row[
"Ins"
].ToString(),
out
indx))
{
Insurance_DataView.Sort =
"ID"
;
InsLabel.Text = Insurance_DataView[Insurance_DataView.Find(indx)][
"Name"
].ToString();
}
else
{
InsLabel.Text =
""
;
}
}
Label CampaignLabel = item.FindControl(
"CampaignLabel"
)
as
Label;
if
(CampaignLabel !=
null
)
{
DataView Campaigns_DataView = (DataView)Campaigns_DataSource.Select(DataSourceSelectArguments.Empty);
int
indx = 0;
if
(Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row[
"Campaign"
].ToString(),
out
indx))
{
Campaigns_DataView.Sort =
"ID"
;
CampaignLabel.Text = Campaigns_DataView[Campaigns_DataView.Find(indx)][
"Campaign"
].ToString();
}
else
{
CampaignLabel.Text =
""
;
}
}
Label CCRepLabel = item.FindControl(
"CCRepLabel"
)
as
Label;
if
(CCRepLabel !=
null
)
{
DataView CCReps_DataView = (DataView)CCReps_DataSource.Select(DataSourceSelectArguments.Empty);
int
indx = 0;
if
(Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row[
"CCRep"
].ToString(),
out
indx))
{
CCReps_DataView.Sort =
"ID"
;
CCRepLabel.Text = CCReps_DataView[CCReps_DataView.Find(indx)][
"Name"
].ToString();
}
else
{
CCRepLabel.Text =
""
;
}
}
Label StateLabel = item.FindControl(
"StateLabel"
)
as
Label;
if
(StateLabel !=
null
)
{
DataView States_DataView = (DataView)States_DataSource.Select(DataSourceSelectArguments.Empty);
int
indx = 0;
if
(Int32.TryParse(((System.Data.DataRowView)(item.DataItem)).Row[
"State"
].ToString(),
out
indx))
{
States_DataView.Sort =
"ID"
;
StateLabel.Text = States_DataView[States_DataView.Find(indx)][
"StateName"
].ToString();
}
else
{
StateLabel.Text =
""
;
}
}
}
}
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName ==
"Delete"
)
{
}
}
}
<%@ Page Title="" Language="C#" MasterPageFile="~/App_Master/Admin.master" AutoEventWireup="true"
CodeFile="Leads.aspx.cs" Inherits="Admin_WriteUps" Theme="Reports" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"Server"
>
<
div
class
=
"container_label"
>
Add/Update/Delete Lead Records:</
div
>
<
div
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Office2007"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadAjaxPanel
ID
=
"RadAjaxPanel1"
runat
=
"server"
HorizontalAlign
=
"NotSet"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
DataSourceID
=
"WriteUps_DataSource"
GridLines
=
"None"
ShowGroupPanel
=
"True"
Skin
=
"Office2007"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
AllowCustomPaging
=
"True"
AllowMultiRowSelection
=
"True"
AutoGenerateColumns
=
"False"
AutoGenerateDeleteColumn
=
"True"
OnItemDataBound
=
"RadGrid1_ItemDataBound"
ShowFooter
=
"True"
PageSize
=
"25"
Width
=
"1200px"
onitemcommand
=
"RadGrid1_ItemCommand"
>
<
ExportSettings
ExportOnlyData
=
"True"
HideStructureColumns
=
"True"
>
<
Excel
Format
=
"ExcelML"
/>
</
ExportSettings
>
<
PagerStyle
AlwaysVisible
=
"True"
/>
<
MasterTableView
CommandItemDisplay
=
"Top"
DataKeyNames
=
"ID"
DataSourceID
=
"WriteUps_DataSource"
EditMode
=
"PopUp"
GroupLoadMode
=
"Client"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
ShowExportToExcelButton
=
"True"
ShowExportToPdfButton
=
"True"
/>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridTemplateColumn
AllowFiltering
=
"False"
DataField
=
"DateAdded"
DataType
=
"System.DateTime"
GroupByExpression
=
"Group By DateAdded desc"
HeaderText
=
"Date "
SortExpression
=
"DateAdded"
UniqueName
=
"DateAdded"
>
<
EditItemTemplate
>
<
telerik:RadDatePicker
ID
=
"RadDatePicker2"
runat
=
"server"
Culture
=
"English (United States)"
DbSelectedDate='<%# Bind("DateAdded") %>'
SelectedDate="2010-10-15" Skin="Office2007">
<
Calendar
Skin
=
"Office2007"
UseColumnHeadersAsSelectors
=
"False"
UseRowHeadersAsSelectors
=
"False"
ViewSelectorText
=
"x"
>
</
Calendar
>
<
DatePopupButton
HoverImageUrl
=
""
ImageUrl
=
""
/>
<
DateInput
DateFormat
=
"M/d/yyyy"
DisplayDateFormat
=
"M/d/yyyy"
SelectedDate
=
"2010-10-15"
>
</
DateInput
>
</
telerik:RadDatePicker
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
runat
=
"server"
ControlToValidate
=
"RadDatePicker2"
ErrorMessage
=
"Date Required"
SetFocusOnError
=
"True"
></
asp:RequiredFieldValidator
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"DateAddedLabel"
runat
=
"server"
Text='<%# Bind("DateAdded", "{0:MM/dd/yyyy}") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"PtName"
GroupByExpression
=
"PtName Group By PtName desc"
HeaderText
=
"Name"
SortExpression
=
"PtName"
UniqueName
=
"PtName"
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
EmptyMessage
=
"Lead Name"
Skin
=
"Office2007"
Text='<%# Bind("PtName") %>' Width="125px">
</
telerik:RadTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
runat
=
"server"
ControlToValidate
=
"RadTextBox1"
ErrorMessage
=
"Name Required"
SetFocusOnError
=
"True"
></
asp:RequiredFieldValidator
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"PtNameLabel"
runat
=
"server"
Text='<%# Bind("PtName") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Ins"
DataType
=
"System.Int32"
HeaderText
=
"Insurance"
SortExpression
=
"Ins"
UniqueName
=
"Ins"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox1"
runat
=
"server"
DataSourceID
=
"Insurance_DataSource"
DataTextField
=
"Name"
DataValueField
=
"ID"
EmptyMessage
=
"Search for Insurance"
MarkFirstMatch
=
"True"
NoWrap
=
"True"
SelectedValue='<%# Bind("Ins") %>' Skin="Office2007">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"InsLabel"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"State"
DataType
=
"System.Int32"
HeaderText
=
"State"
SortExpression
=
"State"
UniqueName
=
"State"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox5"
runat
=
"server"
DataSourceID
=
"States_DataSource"
DataTextField
=
"StateName"
DataValueField
=
"ID"
EmptyMessage
=
"Search for State"
MarkFirstMatch
=
"True"
SelectedValue='<%# Bind("State") %>' Skin="Office2007">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"StateLabel"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
AllowFiltering
=
"False"
DataField
=
"CCRep"
DataType
=
"System.Int32"
HeaderText
=
"Call Center Rep"
SortExpression
=
"CCRep"
UniqueName
=
"CCRep"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox3"
runat
=
"server"
DataSourceID
=
"CCReps_DataSource"
DataTextField
=
"Name"
DataValueField
=
"ID"
EmptyMessage
=
"Search for CC Rep"
MarkFirstMatch
=
"True"
NoWrap
=
"True"
SelectedValue='<%# Bind("CCRep") %>' Skin="Office2007">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"CCRepLabel"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Campaign"
DataType
=
"System.Int32"
HeaderText
=
"Campaign"
SortExpression
=
"Campaign"
UniqueName
=
"Campaign"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox2"
runat
=
"server"
DataSourceID
=
"Campaigns_DataSource"
DataTextField
=
"Campaign"
DataValueField
=
"ID"
EmptyMessage
=
"Search for Campaign"
MarkFirstMatch
=
"True"
NoWrap
=
"True"
SelectedValue='<%# Bind("Campaign") %>' Skin="Office2007">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"CampaignLabel"
runat
=
"server"
></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
AllowFiltering
=
"False"
DataField
=
"Source"
HeaderText
=
"Source"
SortExpression
=
"Source"
UniqueName
=
"Source"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBox4"
runat
=
"server"
SelectedValue='<%# Bind("Source") %>' Skin="Office2007">
<
Items
>
<
telerik:RadComboBoxItem
runat
=
"server"
Selected
=
"true"
Text
=
"Call"
Value
=
"CALL"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Chat"
Value
=
"CHAT"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"E-mail"
Value
=
"E-MAIL"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Walk-In"
Value
=
"WALK-IN"
/>
<
telerik:RadComboBoxItem
runat
=
"server"
Text
=
"Unknown"
Value
=
"UNKNOWN"
/>
</
Items
>
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"SourceLabel"
runat
=
"server"
Text='<%# Bind("Source") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Outcome"
Groupable
=
"False"
HeaderText
=
"Outcome"
SortExpression
=
"Outcome"
UniqueName
=
"Outcome"
>
<
EditItemTemplate
>
<
telerik:RadTextBox
ID
=
"RadTextBox2"
runat
=
"server"
EmptyMessage
=
"Lead Outcome"
Height
=
"75px"
Skin
=
"Office2007"
Text='<%# Bind("Outcome") %>' Width="125px">
</
telerik:RadTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator3"
runat
=
"server"
ControlToValidate
=
"RadTextBox2"
ErrorMessage
=
"Note Required"
SetFocusOnError
=
"True"
></
asp:RequiredFieldValidator
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"OutcomeLabel"
runat
=
"server"
Text='<%# Bind("Outcome") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
>
</
EditColumn
>
</
EditFormSettings
>
<
PagerStyle
AlwaysVisible
=
"True"
/>
</
MasterTableView
>
<
GroupingSettings
ShowUnGroupButton
=
"True"
/>
<
ClientSettings
AllowDragToGroup
=
"True"
>
</
ClientSettings
>
</
telerik:RadGrid
>
</
telerik:RadAjaxPanel
>
<
br
/>
</
div
>
<
asp:SqlDataSource
ID
=
"WriteUps_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
InsertCommand="INSERT INTO [WriteUps] ([DateAdded], [PtName], [Ins], [Campaign], [Outcome], [CCRep], [Source], [NumberCalled], [State]) VALUES (@DateAdded, @PtName, @Ins, @Campaign, @Outcome, @CCRep, @Source, @NumberCalled, @State)"
SelectCommand="SELECT [ID], [DateAdded], [PtName], [Ins], [Campaign], [Outcome], [CCRep], [Source], [NumberCalled], [State] FROM [WriteUps]"
DeleteCommand="DELETE FROM [WriteUps] WHERE [ID] = @original_ID AND (([DateAdded] = @original_DateAdded) OR ([DateAdded] IS NULL AND @original_DateAdded IS NULL)) AND (([PtName] = @original_PtName) OR ([PtName] IS NULL AND @original_PtName IS NULL)) AND (([Ins] = @original_Ins) OR ([Ins] IS NULL AND @original_Ins IS NULL)) AND (([Campaign] = @original_Campaign) OR ([Campaign] IS NULL AND @original_Campaign IS NULL)) AND (([Outcome] = @original_Outcome) OR ([Outcome] IS NULL AND @original_Outcome IS NULL)) AND (([CCRep] = @original_CCRep) OR ([CCRep] IS NULL AND @original_CCRep IS NULL)) AND (([Source] = @original_Source) OR ([Source] IS NULL AND @original_Source IS NULL)) AND (([NumberCalled] = @original_NumberCalled) OR ([NumberCalled] IS NULL AND @original_NumberCalled IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL))"
UpdateCommand="UPDATE [WriteUps] SET [DateAdded] = @DateAdded, [PtName] = @PtName, [Ins] = @Ins, [Campaign] = @Campaign, [Outcome] = @Outcome, [CCRep] = @CCRep, [Source] = @Source, [NumberCalled] = @NumberCalled, [State] = @State WHERE [ID] = @original_ID AND (([DateAdded] = @original_DateAdded) OR ([DateAdded] IS NULL AND @original_DateAdded IS NULL)) AND (([PtName] = @original_PtName) OR ([PtName] IS NULL AND @original_PtName IS NULL)) AND (([Ins] = @original_Ins) OR ([Ins] IS NULL AND @original_Ins IS NULL)) AND (([Campaign] = @original_Campaign) OR ([Campaign] IS NULL AND @original_Campaign IS NULL)) AND (([Outcome] = @original_Outcome) OR ([Outcome] IS NULL AND @original_Outcome IS NULL)) AND (([CCRep] = @original_CCRep) OR ([CCRep] IS NULL AND @original_CCRep IS NULL)) AND (([Source] = @original_Source) OR ([Source] IS NULL AND @original_Source IS NULL)) AND (([NumberCalled] = @original_NumberCalled) OR ([NumberCalled] IS NULL AND @original_NumberCalled IS NULL)) AND (([State] = @original_State) OR ([State] IS NULL AND @original_State IS NULL))"
OldValuesParameterFormatString="original_{0}"
ConflictDetection="CompareAllValues">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"original_ID"
Type
=
"Int32"
/>
<
asp:Parameter
DbType
=
"Date"
Name
=
"original_DateAdded"
/>
<
asp:Parameter
Name
=
"original_PtName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Ins"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Campaign"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Outcome"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_CCRep"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Source"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_NumberCalled"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_State"
Type
=
"Int32"
/>
</
DeleteParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"DateAdded"
DbType
=
"Date"
/>
<
asp:Parameter
Name
=
"PtName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Ins"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Campaign"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Outcome"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CCRep"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Source"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"NumberCalled"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"State"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_ID"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_DateAdded"
DbType
=
"Date"
/>
<
asp:Parameter
Name
=
"original_PtName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_Ins"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Campaign"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Outcome"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_CCRep"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"original_Source"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_NumberCalled"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"original_State"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"DateAdded"
DbType
=
"Date"
/>
<
asp:Parameter
Name
=
"PtName"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Ins"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Campaign"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Outcome"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"CCRep"
Type
=
"Int32"
/>
<
asp:Parameter
Name
=
"Source"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"NumberCalled"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"State"
Type
=
"Int32"
/>
</
InsertParameters
>
</
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"CCReps_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Name] FROM [CCReps]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"Insurance_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Name] FROM [Insurance]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"Referral_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Name] FROM [Referral]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"CareLevel_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [CareLevel] FROM [CareLevels]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"Campaigns_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [Campaign] FROM [Campaigns]"></
asp:SqlDataSource
>
<
asp:SqlDataSource
ID
=
"States_DataSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [ID], [StateCode], [StateName] FROM [States]"></
asp:SqlDataSource
>
</
asp:Content
>