This is a migrated thread and some comments may be shown as answers.

[Solved] No Data after Sorting

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Support ATT
Top achievements
Rank 1
Support ATT asked on 02 Jun 2008, 07:27 PM
2 problems.

1. After Sorting, i click to a page site (Paging). After that, no data appears, why ?

2. I will an sorting only with Ascending and Descending. when i click the sort column, the column should asc or desc and NOT NONE. how can i set the sorting mode only for Asc or Desc. I wan't an 3. State !


http://www.sport-events.ch/sportarten.aspx



public

partial class sportarten : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

if (!Page.IsPostBack)

{

if (Master.FindControl("sportarten") != null)

{

((

HtmlAnchor)Master.FindControl("sportarten")).Attributes["class"] = "selected";

}

fillGrid();

}

}

private void fillGrid()

{

SqlDataAdapter da = null;

DataSet ds = new DataSet();

string query = "";

query =

"SELECT * FROM Sports";

try

{

da =

new SqlDataAdapter(query, ConfigurationManager.ConnectionStrings["ConnectionStringName"].ConnectionString);

DataTable dataTable = new DataTable();

da.Fill(dataTable);

dgSport.DataSource = dataTable;

}

catch (Exception ex)

{

}

finally

{

}

}

protected void dgSport_PageIndexChanged(object source, Telerik.Web.UI.GridPageChangedEventArgs e)

{

fillGrid();

}

protected void dgSport_SortCommand(object source, Telerik.Web.UI.GridSortCommandEventArgs e)

{

fillGrid();

}

protected void dgSport_NeedDataSource(object source, GridNeedDataSourceEventArgs e)

{

fillGrid();

}

}

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 03 Jun 2008, 06:11 AM
Hi Toprak Abdullah,

1.Go through the following forum link which discuss a similar problem.
Problem Paging Grid After Sort

2.To limit the sorting modes to two-way sorting (ascending and descending), set the MasterTableView.SortExpressions.AllowNaturalSort property or the GridTableView.SortExpressions.AllowNaturalSort property to False. When AllowNaturalSort is False, the automatic sequence of sort modes toggles between "Ascending" and "Descending", without allowing a mode of "NoSort".

You can also refer the following help document link.
Controlling sorting modes

Thanks
Shinu.
Tags
Grid
Asked by
Support ATT
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or