public class CustomRadGrid : RadGrid |
{ |
public CustomRadGrid(){ |
ClientSettings.Selecting.EnableDragToSelectRows = false; |
ClientSettings.Resizing.AllowColumnResize = true; |
MasterTableView.AllowFilteringByColumn = false; |
EnableEmbeddedSkins = false; |
AllowMultiRowSelection = true; |
ClientSettings.Selecting.AllowRowSelect = true; |
} |
} |
The above snippet is just a portion of my class
Does anyone have any idea why SelectedRows would be undefined?
I originally had this posted in the older (non ajax) forum, so you may see a duplicate of this message there.
Thanks!
Nicole
I started using Telerik controls for past 3 weeks…..
I am creating a Rad Grid Programmatically based on let’s say Query 2: is how many columns it is going to return from database. Query 2 results are based on Query1.
If Query 1 product type id is Q1A then Query 2 has 4 columns in it.
If Query 1 product type id is Q1B then Query 2 has 6 columns in it.
If Query 1 product type id is Q1C then Query 2 has 7 columns in it….So on.
Aspx page exactly looks like:
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
<asp:View ID="View1" runat="server">
' Some CONTROLS in this VIEW1
</asp:View>
<asp:View ID="View2" runat="server">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<telerik:RadGrid ID="rgvModels" runat="server" Width="950px" AutoGenerateColumns="False" Skin="SDDC" EnableEmbeddedSkins="False" AllowSorting="true">
<MasterTableView>
<Columns>
</Columns>
</MasterTableView>
<ClientSettings> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> </ClientSettings> </telerik:RadGrid>
</ContentTemplate>
</asp:UpdatePanel>
</asp:View>
</ContentTemplate>
</asp:UpdatePanel>
Protected Function ProdGrid(ByVal aid As String, ByVal pid As String) As DataTable
Dim table2 As New DataTable
Dim pConn As New OracleConnection(SQLConnStr)
Dim ptID As String = String.Empty
Label3.Text = String.Empty
Dim archSQL As String = "select column1 from table 1 where id = '" & pid & "' "
Dim aConn As New OracleConnection(SQLConnStr)
aConn.Open()
Try
Dim aComm As OracleCommand = New OracleCommand(archSQL, aConn)
ptID = aComm.ExecuteScalar
Catch ex As Exception
ptID = "no data available"
End Try
If System.String.IsNullOrEmpty(ptID.ToString) Then ptID = 0
Select Case ptID
Case 1, 2
prodSQL = "select distinct c1, c2, c3 from table4 where prod='" & pid & "' order by c1"
rgvModels.MasterTableView.Columns.Clear()
' ----- column 1: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c1"
boundColumn.HeaderText = "c1"
boundColumn.SortExpression = "ia"
' ----- column 2: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c1"
boundColumn.HeaderText = "c2"
boundColumn.SortExpression = "c2"
' ----- column 3: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c3"
boundColumn.HeaderText = "c3"
boundColumn.SortExpression = "c3"
Case 3
prodSQL = "select distinct c1, c2, c3,c4,c5 from table4
where prod='" & pid & "'order by c1"
rgvModels.MasterTableView.Columns.Clear()
' ----- column 1: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c1"
boundColumn.HeaderText = "c1"
boundColumn.SortExpression = "c1"
' ----- column 2: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c2"
boundColumn.HeaderText = "c2"
boundColumn.SortExpression = "c2"
' ----- column 3: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c3"
boundColumn.HeaderText = "c3"
boundColumn.SortExpression = "c3"
' ----- column 4: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c4"
boundColumn.HeaderText = "c4"
boundColumn.SortExpression = "c4"
' ----- column 5: -----
boundColumn = New Telerik.Web.UI.GridBoundColumn
rgvModels.MasterTableView.Columns.Add(boundColumn)
boundColumn.DataField = "c5"
boundColumn.HeaderText = "c5"
boundColumn.SortExpression = "c5"
End Select
Dim adapter As OracleDataAdapter = New OracleDataAdapter
adapter.SelectCommand = New OracleCommand(prodSQL, pConn)
pConn.Open()
adapter.SelectCommand = New OracleCommand(prodSQL, pConn)
adapter.Fill(table2)
rgvModels.DataSource = table2
Catch ex As Exception
Label3.Text = "<b class='red'>There was a problem:</b><br/>" & ex.Message.ToString
Finally
pConn.Close()
pConn.Dispose()
OracleConnection.ClearPool(pConn)
End Try
Return table2
End Function
' ----- NEEDDATASOURCE EVENT DEFINITION ----
Public
Sub rgvModels_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgvModels.NeedDataSource
ProdGrid(rqVal, Session(
"ProdID"))
End Sub
' ----- SORT COMMAND EVENT DEFINITION ----
Protected Sub rgvModels_SortCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridSortCommandEventArgs) Handles rgvModels.SortCommand
rgvModels.MasterTableView.SortExpressions.Clear()
ProdGrid(rqVal, Session("ProdID"))
rgvModels.DataSource = Nothing
rgvModels.Rebind()
End Sub
' ----- BUTTON CLICK EVENT DEFINITION ----
On the link button click event which actually loads the RAD grid I have following code…
' This is where product id comes from or Query 1 is based on this user clicked value
rgvModels.MasterTableView.SortExpressions.Clear()
rgvModels.DataSource = Nothing
rgvModels.Rebind()
MY QUESTION:
1) My rad grid will sort the first time very fine ascendingly.
2) If I try to click it again it will not sort again to descending order. Am I missing something here which it does not make it to sort descending?
3) I am even trying to clear sortexpressions in 3 places.
4) I saw this link
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-clear-sorting.aspx
If this is the solution. I am sorry I don’t understand the Javascript solution to it. Leave alone the next solution by Maxim Tairov Posted on Jul 18, 2011. I definitely don’t get this.
PLEASE HELP.
Thanks,
Vidya
Hai,
I have a problem with telerik ajax "Calendar".
I managed to set the "DateTime.now" on the page load and it is working perfectly for me.
But the problem is when I click to Navigate using the "prev month, prev year, next month or next year" a "default date is to be selected", instead here the prevoiusly selected date (that is DateTime.now value) exists if any one one of the "Navigation is clicked".
Actually I want a postback on the calendar click and I am plannning to load the data correspending to the "Selected Date". But here the selected date doesnot change on the Navigation Click.
You can see the "system calender" set a default value on the Navigation click to "default 1 st day of the corresponding Month and year".
Is it possible to set a default date on the Navigation month and year click. This is very much needed for this.
And as a workaround "Can we manage to set a default date on the clientside of the navigation cllick"
Any Help is appreciated,
,<
root
>
<
tools
name
=
"MainToolbar"
dockingzone
=
"editorToolbar"
isribbon
=
"false"
dockable
=
"true"
>
<
tool
name
=
"Bold"
/>
<
tool
name
=
"Italic"
/>
<
tool
name
=
"Underline"
/>
<
tool
name
=
"StrikeThrough"
/>
<
tool
name
=
"FontName"
/>
<
tool
name
=
"ForeColor"
/>
<
tool
separator
=
"true"
/>
<
tool
name
=
"JustifyLeft"
/>
<
tool
name
=
"JustifyCenter"
/>
<
tool
name
=
"JustifyRight"
/>
<
tool
name
=
"JustifyFull"
/>
<
tool
name
=
"JustifyNone"
/>
<
tool
separator
=
"true"
/>
<
tool
name
=
"Superscript"
/>
<
tool
name
=
"Subscript"
/>
<
tool
separator
=
"true"
/>
<
tool
name
=
"ConvertToLower"
/>
<
tool
name
=
"ConvertToUpper"
/>
<
tool
name
=
"Indent"
/>
<
tool
name
=
"Outdent"
/>
<
tool
name
=
"InsertOrderedList"
/>
<
tool
name
=
"InsertUnorderedList"
/>
</
tools
>
</
root
>
<
PageSubTitleTemplate
>
<
div
id
=
"editorToolbarWrapper"
runat
=
"server"
class
=
"editorToolbarWrapper"
>
<
div
id
=
"editorToolbar"
></
div
>
</
div
>
</
PageSubTitleTemplate
>
<
PageContentTemplate
>
<
telerik:RadEditor
ID
=
"m_UIEmailEditor"
runat
=
"server"
SkinID
=
"EmailEditor"
OnClientLoad
=
"OnClientLoad"
>
</
telerik:RadEditor
> <
telerik:RadEditor
ID
=
"m_UIEmailEditor"
runat
=
"server"
SkinID
=
"EmailEditor"
OnClientLoad
=
"OnClientLoad"
>
</
telerik:RadEditor
>
</
PageContentTemplate
>
Hi all,
Please hlelp on this issue , It is very urgent .
I need to do goup by (By Drag and drop ) . When I am using GridBoundColumn It is working fine. but when i am using
GridTemplateColumn with HeaderTemplate . I am not able to do drag and drop columns to do groupby and sorting the column also.I am not binding values in the header template . I am just arranging with a label with text value set directly and image.
Whether Is it mandatroy that i must bind some thing to the label in header template. I couldnt understand why it is not working .
Here is code i am using
<
telerik:GridTemplateColumn
GroupByExpression
=
"CloseOutType"
DataField
=
"CloseOutType"
SortExpression
=
"CloseOutType"
HeaderStyle-CssClass
=
"xmediumcolsize"
>
<
HeaderTemplate
>
<
asp:Image
ID
=
"imgCloseOutType"
ImageUrl
=
"~/Images/closeout_type.png"
runat
=
"server"
/>
<
asp:Label
ID
=
"lblheaderCloseOutType"
runat
=
"server"
Text
=
"Interim/Workbook"
></
asp:Label
>
<%-- <
asp:HiddenField
ID
=
"HiddenField1"
Value='<%# eval("CloseOutType") %>' runat="server" />--%>
</
HeaderTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lblCloseOutType"
runat
=
"server"
Text='<%# eval("CloseOutType") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
Hello,
I'm trying to use the control RadAjaxLoadingPanel based on the demo http://demos.telerik.com/aspnet-ajax/ajax/examples/loadingpanel/loadingimages/defaultcs.aspx .
For unkown reason, it is not working, the RadAjaxLoadingPanel control is not displayed.
Note: I'm using the 2009.3.1314.35 Version.
Here is my page:
Aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
<
style
type
=
"text/css"
>
.module1
{
background-color: #dff3ff;
border: 1px solid #c6e1f2;
}
</
style
>
<
Telerik:RadStyleSheetManager
ID
=
"SSH1"
EnableStyleSheetCombine
=
"true"
runat
=
"server"
>
<
StyleSheets
>
<
Telerik:StyleSheetReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Skins.Editor.css"
/>
<
Telerik:StyleSheetReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Skins.Default.Editor.Default.css"
/>
<
Telerik:StyleSheetReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Skins.Window.css"
/>
<
Telerik:StyleSheetReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Skins.Default.Window.Default.css"
/>
</
StyleSheets
>
</
Telerik:RadStyleSheetManager
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"Panel1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"Panel1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"CheckBox1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"DropDownList1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
asp:Panel
runat
=
"server"
ID
=
"ConfigurationPanel1"
Title
=
"Configurator"
Expanded
=
"true"
>
<
table
>
<
tr
>
<
td
style
=
"width: 200px"
>
<
asp:CheckBox
ID
=
"CheckBox1"
runat
=
"server"
Text
=
"EnableSkinTransparency"
Checked
=
"true"
AutoPostBack
=
"true"
OnCheckedChanged
=
"CheckBox1_CheckedChanged"
/><
br
/>
<
br
/>
</
td
>
<
td
>
Change Background Position:<
br
/>
<
asp:DropDownList
ID
=
"DropDownList1"
runat
=
"server"
AutoPostBack
=
"true"
OnSelectedIndexChanged
=
"DropDownList1_SelectedIndexChanged"
>
<
asp:ListItem
>Bottom</
asp:ListItem
>
<
asp:ListItem
>BottomLeft</
asp:ListItem
>
<
asp:ListItem
>BottomRight</
asp:ListItem
>
<
asp:ListItem
Selected
=
"True"
>Center</
asp:ListItem
>
<
asp:ListItem
>Left</
asp:ListItem
>
<
asp:ListItem
>None</
asp:ListItem
>
<
asp:ListItem
>Right</
asp:ListItem
>
<
asp:ListItem
>Top</
asp:ListItem
>
<
asp:ListItem
>TopLeft</
asp:ListItem
>
<
asp:ListItem
>TopRight</
asp:ListItem
>
</
asp:DropDownList
>
</
td
>
</
tr
>
</
table
>
</
asp:Panel
>
<
fieldset
class
=
"module1"
>
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
HorizontalAlign
=
"Center"
Height
=
"275px"
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Click to see the loading image"
OnClick
=
"Button1_Click"
Style
=
"margin-top: 15px; margin-left: 15px"
CssClass
=
"qsfButtonBigger"
/>
</
asp:Panel
>
</
fieldset
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<!-- content end -->
</
div
>
</
form
>
</
body
>
</
html
>
c#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//simulate longer page load
System.Threading.Thread.Sleep(2000);
}
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
RadAjaxLoadingPanel1.EnableSkinTransparency = (sender as CheckBox).Checked;
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
AjaxLoadingPanelBackgroundPosition position = new AjaxLoadingPanelBackgroundPosition();
if (DropDownList1.SelectedValue == "Bottom")
{
position = AjaxLoadingPanelBackgroundPosition.Bottom;
}
if (DropDownList1.SelectedValue == "BottomLeft")
{
position = AjaxLoadingPanelBackgroundPosition.BottomLeft;
}
if (DropDownList1.SelectedValue == "BottomRight")
{
position = AjaxLoadingPanelBackgroundPosition.BottomRight;
}
if (DropDownList1.SelectedValue == "Center")
{
position = AjaxLoadingPanelBackgroundPosition.Center;
}
if (DropDownList1.SelectedValue == "Left")
{
position = AjaxLoadingPanelBackgroundPosition.Left;
}
if (DropDownList1.SelectedValue == "None")
{
position = AjaxLoadingPanelBackgroundPosition.None;
}
if (DropDownList1.SelectedValue == "Right")
{
position = AjaxLoadingPanelBackgroundPosition.Right;
}
if (DropDownList1.SelectedValue == "Top")
{
position = AjaxLoadingPanelBackgroundPosition.Top;
}
if (DropDownList1.SelectedValue == "TopLeft")
{
position = AjaxLoadingPanelBackgroundPosition.TopLeft;
}
if (DropDownList1.SelectedValue == "TopRight")
{
position = AjaxLoadingPanelBackgroundPosition.TopRight;
}
RadAjaxLoadingPanel1.BackgroundPosition = position;
}
}
Please, I need you help,
It is apprecited to send me the modified code.
Regards,
Bader
<
div
>
<
telerik:RadGrid
id
=
"RadGrid1"
runat
=
"server"
gridlines
=
"None"
allowpaging
=
"True"
allowsorting
=
"True"
autogeneratecolumns
=
"False"
width
=
"97%"
enableajax
=
"True"
CellSpacing
=
"0"
DataSourceID
=
"SqlDataSource1"
AllowFilteringByColumn
=
"True"
onneeddatasource
=
"RadGrid1_NeedDataSource"
ShowFooter
=
"True"
Skin
=
"Black"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
ClientSettings
AllowColumnsReorder
=
"True"
ReorderColumnsOnClient
=
"True"
>
<
Selecting
AllowRowSelect
=
"True"
/>
</
ClientSettings
>
<
MasterTableView
GridLines
=
"None"
Width
=
"100%"
CommandItemSettings-ShowExportToCsvButton
=
"true"
CommandItemSettings-ShowAddNewRecordButton
=
"false"
CommandItemDisplay
=
"Top"
DataSourceID
=
"SqlDataSource1"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"SequencialNumber"
HeaderText
=
"SequencialNumber"
UniqueName
=
"SequencialNumber"
SortExpression
=
"SequencialNumber"
>
.......