I have a rad grid on my web page and what I want to do is inline editing on only a few cells in a row. When the quantity cell is changed, I would like to be able to make some calculations and change some of the other cells in the grid that are read only. I have the grid up and have the edit button, but I don't know how to get those values to change the other cells before it updates the database. I've tried a couple different ways and the only values I get are for every cell.
Here's my source code for the grid and sqldatasource.
I know I have to add some parameters for the update sqldatasource yet. But I figured I have to figure out this problem before i can even think about doing that part of it yet. So, when I click edit and change the values I need to, how do I grab all the values to do some calculations and then to update the database to then refresh the grid?
Here's my source code for the grid and sqldatasource.
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
Skin
=
"Telerik"
AllowAutomaticDeletes
=
"True"
DataSourceID
=
"SqlDataSourceQuoteItems"
GridLines
=
"None"
AllowAutomaticInserts
=
"True"
OnItemDeleted
=
"RadGrid1_ItemDeleted"
OnItemInserted
=
"RadGrid1_ItemInserted"
>
<
MasterTableView
DataSourceID
=
"SqlDataSourceQuoteItems"
CommandItemDisplay
=
"TopAndBottom"
AutoGenerateColumns
=
"False"
DataKeyNames
=
"id"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
>
<
ItemStyle
CssClass
=
"MyImageButton"
/>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"id"
DataType
=
"System.Int32"
HeaderText
=
"id"
ReadOnly
=
"True"
SortExpression
=
"id"
UniqueName
=
"id"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"QuoteNo"
HeaderText
=
"QuoteNo"
SortExpression
=
"QuoteNo"
UniqueName
=
"QuoteNo"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Room"
HeaderText
=
"Room"
SortExpression
=
"Room"
UniqueName
=
"Room"
ColumnEditorID
=
"GridTextBoxRoom"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Elevation"
HeaderText
=
"Elevation"
SortExpression
=
"Elevation"
UniqueName
=
"Elevation"
ColumnEditorID
=
"GridTextBoxElevation"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"PartNo"
HeaderText
=
"PartNo"
SortExpression
=
"PartNo"
UniqueName
=
"PartNo"
ColumnEditorID
=
"GridTextBoxPartNo"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Qty"
DataType
=
"System.Double"
HeaderText
=
"Qty"
SortExpression
=
"Qty"
UniqueName
=
"Qty"
ColumnEditorID
=
"GridNumericQty"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ListPrice"
DataType
=
"System.Double"
HeaderText
=
"Price"
SortExpression
=
"ListPrice"
UniqueName
=
"ListPrice"
ColumnEditorID
=
"GridTextBoxListPrice"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TotalPrice"
DataType
=
"System.Double"
HeaderText
=
"Total Price"
SortExpression
=
"TotalPrice"
UniqueName
=
"TotalPrice"
ColumnEditorID
=
"GridTextBoxTotalPrice"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EachWeight"
DataType
=
"System.Double"
HeaderText
=
"Weight"
SortExpression
=
"EachWeight"
UniqueName
=
"EachWeight"
ColumnEditorID
=
"GridTextBoxEachWeight"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TotalWeight"
DataType
=
"System.Double"
HeaderText
=
"Total Weight"
SortExpression
=
"TotalWeight"
UniqueName
=
"TotalWeight"
ColumnEditorID
=
"GridTextBoxTotalWeight"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"EachCubes"
DataType
=
"System.Double"
HeaderText
=
"Cubes"
SortExpression
=
"EachCubes"
UniqueName
=
"EachCubes"
ColumnEditorID
=
"GridTextBoxEachCubes"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TotalCubes"
DataType
=
"System.Double"
HeaderText
=
"Total Cubes"
SortExpression
=
"TotalCubes"
UniqueName
=
"TotalCubes"
ColumnEditorID
=
"GridTextBoxTotalCubes"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"DeleteColumn"
>
<
ItemStyle
HorizontalAlign
=
"Center"
CssClass
=
"MyImageButton"
/>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
ColumnNumber
=
"7"
CaptionDataField
=
"PartNo"
CaptionFormatString
=
"Edit properties of Product {0}"
>
<
FormTableItemStyle
Wrap
=
"False"
></
FormTableItemStyle
>
<
FormCaptionStyle
CssClass
=
"EditFormHeader"
></
FormCaptionStyle
>
<
FormMainTableStyle
GridLines
=
"None"
CellSpacing
=
"0"
CellPadding
=
"3"
BackColor
=
"White"
Width
=
"100%"
/>
<
FormTableStyle
CellSpacing
=
"0"
CellPadding
=
"2"
Height
=
"110px"
BackColor
=
"White"
/>
<
FormTableAlternatingItemStyle
Wrap
=
"False"
></
FormTableAlternatingItemStyle
>
<
EditColumn
ButtonType
=
"ImageButton"
InsertText
=
"Insert Product"
UpdateText
=
"Update record"
UniqueName
=
"EditCommandColumn1"
CancelText
=
"Cancel edit"
>
</
EditColumn
>
<
FormTableButtonRowStyle
HorizontalAlign
=
"Right"
CssClass
=
"EditFormButtonRow"
></
FormTableButtonRowStyle
>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnRowDblClick
=
"RowDblClick"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxRoom"
runat
=
"server"
TextBoxStyle-Width
=
"25px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxElevation"
runat
=
"server"
TextBoxStyle-width
=
"25px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxPartNo"
runat
=
"server"
TextBoxStyle-width
=
"90px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxListPrice"
runat
=
"server"
TextBoxStyle-width
=
"45px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxTotalPrice"
runat
=
"server"
TextBoxStyle-width
=
"45px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxEachWeight"
runat
=
"server"
TextBoxStyle-width
=
"35px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxTotalWeight"
runat
=
"server"
TextBoxStyle-width
=
"35px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxEachCubes"
runat
=
"server"
TextBoxStyle-width
=
"40px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridTextBoxTotalCubes"
runat
=
"server"
TextBoxStyle-width
=
"40px"
/>
<
telerik:GridTextBoxColumnEditor
ID
=
"GridNumericQty"
runat
=
"server"
TextBoxStyle-width
=
"35px"
/>
<
telerik:RadWindowManager
ID
=
"RadWindowManager2"
runat
=
"server"
></
telerik:RadWindowManager
>
<
asp:SqlDataSource
ID
=
"SqlDataSourceQuoteItems"
runat
=
"server"
ConnectionString
=
"Data Source=DWDATA2;Initial Catalog=DWJobInfo;Integrated Security=True"
ProviderName
=
"System.Data.SqlClient"
SelectCommand
=
"SELECT * FROM [tblMetalCabsQuoteItems] WHERE ([QuoteNo] = @QuoteNo) ORDER BY [Room], [Elevation]"
DeleteCommand
=
"DELETE FROM tblMetalCabsItems WHERE id = @id"
>
<
SelectParameters
>
<
asp:ControlParameter
ControlID
=
"lblQuoteNo"
Name
=
"QuoteNo"
PropertyName
=
"Text"
Type
=
"String"
/>
</
SelectParameters
>
<
DeleteParameters
>
<
asp:Parameter
Name
=
"id"
Type
=
"Int16"
/>
</
DeleteParameters
>
</
asp:SqlDataSource
>
I know I have to add some parameters for the update sqldatasource yet. But I figured I have to figure out this problem before i can even think about doing that part of it yet. So, when I click edit and change the values I need to, how do I grab all the values to do some calculations and then to update the database to then refresh the grid?