Hi,
the SQLdatasource is not working with the grid. I have no code-behind just using the SQLdatasource object.
Here is the code:
I used several examples on this forum but have had no luck in firing these events.
Thank You,
the SQLdatasource is not working with the grid. I have no code-behind just using the SQLdatasource object.
Here is the code:
I used several examples on this forum but have had no luck in firing these events.
Thank You,
<
telerik:RadScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
telerik:RadGrid
ID
=
"rdgBudget"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowPaging
=
"True"
AllowSorting
=
"True"
DataSourceID
=
"SEMBudgetSource"
GridLines
=
"None"
Skin
=
"Office2007"
AllowAutomaticInserts
=
"true"
AllowAutomaticUpdates
=
"true"
OnItemDataBound
=
"Budget_ItemDataBound"
>
<
MasterTableView
AutoGenerateColumns
=
"False"
DataSourceID
=
"SEMBudgetSource"
CommandItemDisplay
=
"Top"
DataKeyNames
=
"SEMBudgetId"
>
<
EditFormSettings
>
<
EditColumn
CancelImageUrl
=
"../Images/Cancel.gif"
EditImageUrl
=
"../Images/Edit.gif"
InsertImageUrl
=
"../Images/Insert.gif"
UniqueName
=
"EditCommandColumn"
UpdateImageUrl
=
"../Images/Update.gif"
>
</
EditColumn
>
</
EditFormSettings
>
<
Columns
>
<
telerik:GridEditCommandColumn
UniqueName
=
"EditCommandColumn"
ButtonType
=
"ImageButton"
/>
<
telerik:GridBoundColumn
DataField
=
"SEMBudgetId"
DataType
=
"System.Int32"
ReadOnly
=
"True"
UniqueName
=
"SEMBudgetId"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Customer"
DefaultInsertValue
=
""
HeaderText
=
"Customer"
SortExpression
=
"Customer"
UniqueName
=
"Customer"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MarginBudget"
DataType
=
"System.Decimal"
DefaultInsertValue
=
""
HeaderText
=
"SEM Budget"
SortExpression
=
"MarginBudget"
UniqueName
=
"MarginBudget"
DataFormatString
=
"{0:C}"
ItemStyle-HorizontalAlign
=
"Right"
>
<
ItemStyle
HorizontalAlign
=
"Right"
></
ItemStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"BudgetSpent"
DataType
=
"System.Decimal"
DefaultInsertValue
=
""
HeaderText
=
"Budget Spent"
SortExpression
=
"BudgetSpent"
UniqueName
=
"BudgetSpent"
ReadOnly
=
"true"
DataFormatString
=
"{0:C}"
ItemStyle-HorizontalAlign
=
"Right"
>
<
ItemStyle
HorizontalAlign
=
"Right"
></
ItemStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"BudgetStartDate"
DataType
=
"System.DateTime"
DefaultInsertValue
=
""
HeaderText
=
"Start Date"
SortExpression
=
"BudgetStartDate"
UniqueName
=
"BudgetStartDate"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"BudgetEndDate"
DataType
=
"System.DateTime"
DefaultInsertValue
=
""
HeaderText
=
"End Date"
SortExpression
=
"BudgetEndDate"
UniqueName
=
"BudgetEndDate"
>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
DataField
=
"BudgetIsActive"
DataType
=
"System.Boolean"
DefaultInsertValue
=
""
HeaderText
=
"BudgetIsActive"
SortExpression
=
"BudgetIsActive"
UniqueName
=
"Active"
>
</
telerik:GridCheckBoxColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
DataBinding-EnableCaching
=
"true"
>
<
DataBinding
EnableCaching
=
"True"
>
</
DataBinding
>
</
ClientSettings
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SEMBudgetSource"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:myconnection %>"
SelectCommand="SELECT [Customer], [MarginBudget], [SEMBudgetId], [BudgetStartDate], [BudgetEndDate], [BudgetIsActive], [BudgetSpent] FROM [mytesttable] WHERE ([companyid] IS NOT NULL) ORDER BY [Customer]"
InsertCommand="INSERT INTO mytesttable(Customer, MarginBudget, BudgetStartDate, BudgetEndDate, BudgetIsActive) VALUES (@Customer, @Budget, @StartDate, @EndDate, @Active)"
UpdateCommand="UPDATE mytesttable SET Customer = @Customer, MarginBudget = @Budget, BudgetStartDate = @StartDate, BudgetEndDate = @EndDate, BudgetIsActive = @Active WHERE (SEMBudgetId = @BID)">
<
UpdateParameters
>
<
asp:Parameter
Name
=
"Customer"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Budget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Active"
Type
=
"Boolean"
/>
<
asp:Parameter
Name
=
"BID"
Type
=
"Int32"
/>
</
UpdateParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"Customer"
Type
=
"String"
/>
<
asp:Parameter
Name
=
"Budget"
Type
=
"Decimal"
/>
<
asp:Parameter
Name
=
"StartDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"EndDate"
Type
=
"DateTime"
/>
<
asp:Parameter
Name
=
"Active"
Type
=
"Boolean"
/>
</
InsertParameters
>
</
asp:SqlDataSource
>