when i refresh the page after that, i see it ok.
How do i prevent the posting back and how do i make it display the contents ok.
this is my grid:
<
telerik:RadGrid
ID
=
"RadGridMailingList"
Width
=
"97%"
AllowSorting
=
"True"
PageSize
=
"15"
AllowPaging
=
"True"
runat
=
"server"
Culture
=
"he-IL"
ShowStatusBar
=
"True"
GridLines
=
"Vertical"
>
<
ExportSettings
ExportOnlyData
=
"True"
FileName
=
"MailingList"
IgnorePaging
=
"True"
OpenInNewWindow
=
"True"
>
</
ExportSettings
>
<
MasterTableView
Width
=
"100%"
Summary
=
"RadGrid table"
Dir
=
"RTL"
NoMasterRecordsText
=
"אין רשומות להצגה."
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ExportToPdfText
=
"יצוא ל PDF"
ShowExportToCsvButton
=
"True"
ShowExportToExcelButton
=
"True"
ShowExportToWordButton
=
"True"
ExportToCsvText
=
"יצוא ל CSV"
ExportToExcelText
=
"יצוא לאקסל"
ExportToWordText
=
"יצוא ל Word"
RefreshText
=
"רענון"
ShowAddNewRecordButton
=
"False"
ShowRefreshButton
=
"False"
></
CommandItemSettings
>
<
PagerStyle
PagerTextFormat="Change page: {4} עמוד <strong>{0}</
strong
> מתוך <
strong
>{1}</
strong
>, פריטים <
strong
>{2}</
strong
> עד <
strong
>{3}</
strong
> מתוך <
strong
>{5}</
strong
>." />
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
PageSizeLabelText
=
"גודל עמוד:"
VerticalAlign
=
"Middle"
/>
<
StatusBarSettings
LoadingText
=
"טוען..."
ReadyText
=
"מוכן"
/>
</
telerik:RadGrid
>
also there is a bug in
PageSizeLabelText
, seems like the value can't be applied and the original "Page Size:" remains.9 Answers, 1 is accepted
Can you elaborate on how it the problematic grid bound? Are you using simple data-binding or have bound the grid through its NeedDataSource event?
All the best,
Iana
the Telerik team

static string mConnectionString = ConfigurationManager.ConnectionStrings["conn"].ToString();
DataTable dtMailingList = new DataTable();
string select = "SELECT userid , FName as , LName as ,email as FROM [USERS]";
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
fillDataTable(select);
RadGridMailingList.DataSource = dtMailingList;
}
}
public void fillDataTable(string query)
{
SqlConnection conn = new SqlConnection(mConnectionString);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand =
new SqlCommand(query, conn);
conn.Open();
try
{
adapter.Fill(dtMailingList);
}
finally
{
conn.Close();
}
}

When using simple data-binding, you will need to assign data-source and rebind the grid after each operation (paging, sorting, editing, etc.) like in MS DataGrid behavior.
I would suggest you to use Advanced Data Binding technique by attaching NeedDataSource event. Now in the NeedDataSource event, set the DataSource of grid as shown in the demo. The NeedDataSource event is especially designed to facilitate the work of the developers as you do not need to handle any sorting/paging/grouping/filtering/etc. commands manually.
-Shinu.

However , I have a button in my page which generates a new select query upon user filling checkboxes.
the button event should update the grid with the new datatable, however, i get an empty grid after clicking a button.:
public
DataTable GetDataTable(
string
query)
{
SqlConnection conn =
new
SqlConnection(mConnectionString);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable myDataTable =
new
DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return
myDataTable;
}
protected
void
RadGrid1_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGridMailingList.DataSource = GetDataTable(select);
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
select =
"SELECT userid, FName , LName,email FROM [USERS]"
+
"Where..."
;
RadGridMailingList.DataSource = GetDataTable(select);
}
Also I still have a full post back when paging or sorting, even though i am using a radajaxmanager:
<telerik:RadAjaxManager ID=
"RadAjaxManager1"
runat=
"server"
>
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID=
"RadGridMailingList"
>
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID=
"RadGridMailingList"
/>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>

You need to set the DataSource only in the NeedDataSource event of grid. In the button-click event handler, rebulid the query and Rebind the grid, which in turn call the NeedDataSource and populates the grid.
C#:
static
string
mConnectionString = ConfigurationManager.ConnectionStrings[
"conn"
].ToString();
string
select =
"SELECT userid , FName as , LName as ,email as FROM [USERS]"
;
public
DataTable GetDataTable(
string
query)
{
SqlConnection conn =
new
SqlConnection(mConnectionString);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable myDataTable =
new
DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return
myDataTable;
}
protected
void
RadGridMailingList_NeedDataSource(
object
source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
{
RadGridMailingList.DataSource = GetDataTable(select);
}
protected
void
Button1_Click(
object
sender, EventArgs e)
{
select =
"SELECT userid, FName , LName,email FROM [USERS]"
+
"Where..."
;
RadGridMailingList.Rebind();
}
Thanks,
Princy.


and nothing happens.
This behavior can be observed when you are trying to export ajaxified grid without disabling the ajax during export. Check out this online help topic and see if it helps.
All the best,
Iana
the Telerik team

I simply added :
ClientEvents-OnRequestStart="onRequestStart"
to my :
<telerik:RadAjaxManager ID="RadAjaxManager1"
runat="server">
and added the javascript function:
function onRequestStart(sender, args)
{
if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
args.get_eventTarget().indexOf(
"ExportToCsvButton") >= 0 ||
args.get_eventTarget().indexOf(
"ExportToWordButton") >= 0)
args.set_enableAjax(
false);
}
please, don't forget also to remember the bug about the
PageSizeLabelText .