or
function
CheckSelectedRows(strCtrlColumnName, strColumnName) {
var
gridType =
'GrdApplication'
;
var
grid = $find(gridType);
var
MasterTable = grid.get_masterTableView();
var
Rows = MasterTable.get_dataItems();
for
(
var
i = 0; i < Rows.length; i++) {
var
cell = MasterTable.getCellByColumnUniqueName(Rows[i], strCtrlColumnName);
var
curRow = MasterTable.getCellByColumnUniqueName(Rows[i], strColumnName);
if
(Selectedvalue !=
''
) {
Selectedvalue = Selectedvalue +
'\r\n'
+ curRow.innerHTML;
}
}
}
I have a RadGrid on my page, and have the ReorderColumnsOnClient property set to true. This all works fine.
However, I also have a requirement to hide columns which are dragged *off* the grid.
Anybody have any ideas on how I might do this?
PS - I'd prefer to do this with the the regular Telerik events, as opposed to using undocumented functionality which might break on the next version.
Here's the prototype aspx I created.
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content
ID
=
"HeaderContent"
runat
=
"server"
ContentPlaceHolderID
=
"HeadContent"
>
</
asp:Content
>
<
asp:Content
ID
=
"BodyContent"
runat
=
"server"
ContentPlaceHolderID
=
"MainContent"
>
<
h2
>
How do I detect a column has been dragged off the grid?
</
h2
>
<
asp:ScriptManager
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
DataSourceID
=
"SqlDataSource1"
GridLines
=
"None"
>
<
ClientSettings
AllowColumnsReorder
=
"True"
ReorderColumnsOnClient
=
"True"
>
</
ClientSettings
>
<
MasterTableView
DataKeyNames
=
"ProductID"
DataSourceID
=
"SqlDataSource1"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"ProductID"
DataType
=
"System.Int32"
HeaderText
=
"ProductID"
ReadOnly
=
"True"
SortExpression
=
"ProductID"
UniqueName
=
"ProductID"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ProductName"
HeaderText
=
"ProductName"
SortExpression
=
"ProductName"
UniqueName
=
"ProductName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"CategoryName"
HeaderText
=
"CategoryName"
SortExpression
=
"CategoryName"
UniqueName
=
"CategoryName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"UnitPrice"
DataType
=
"System.Decimal"
HeaderText
=
"UnitPrice"
SortExpression
=
"UnitPrice"
UniqueName
=
"UnitPrice"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"UnitsInStock"
DataType
=
"System.Int16"
HeaderText
=
"UnitsInStock"
SortExpression
=
"UnitsInStock"
UniqueName
=
"UnitsInStock"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT [ProductID], [ProductName], [CategoryName], [UnitPrice], [UnitsInStock] FROM [Alphabetical list of products]">
</
asp:SqlDataSource
>
</
asp:Content
>
<
add
name
=
"NorthwindConnectionString"
connectionString
=
"Data Source=.;Initial Catalog=Northwind;Integrated Security=True"
providerName
=
"System.Data.SqlClient"
/>
protected
void
GrdConfig_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
Hashtable newValues =
new
Hashtable();
((GridEditableItem)e.Item).ExtractValues(newValues);
Alert.Show(newValues[
"ColumnName"
].ToString());
...
Working SQL code
...
}