ccfriend
January 28th, 2006, 08:07 AM
Hi
I have an aspx page that consumes a web service that return a dataset.
Here is a sample code:
WSSearch temp = new WSSearch(); //Load web service
DataSet temp = temp.Ws_seach(TextBox2Title.Text); //call web method
GridView1Search.DataSource = temp.Tables[0]; //assign the return dataset (the first DataTable)
GridView1Search.DataBind(); //binding stuff
After that my GridView is show all the records that dataset contains
My first problem is that one of the columns contains as data a link and I want to make it a link (that's it to press it and load a http page).
Is there any way to do it?
My second problem is that when I add a statement:
GridView1Search.AllowSorting = true;
And I push the field header in order to sort by field, an exception is thrown. Take a look:
The GridView 'GridView1Search' fired event Sorting which wasn't handled.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The GridView 'GridView1Search' fired event Sorting which wasn't handled.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The GridView 'GridView1Search' fired event Sorting which wasn't handled.]
System.Web.UI.WebControls.GridView.OnSorting(GridViewSortEventArgs e) +236
System.Web.UI.WebControls.GridView.HandleSort(String sortExpression, SortDirection sortDirection) +77
System.Web.UI.WebControls.GridView.HandleSort(String sortExpression) +71
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +545
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +190
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4919
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
So there is any way to make the sort work out ?
I have an aspx page that consumes a web service that return a dataset.
Here is a sample code:
WSSearch temp = new WSSearch(); //Load web service
DataSet temp = temp.Ws_seach(TextBox2Title.Text); //call web method
GridView1Search.DataSource = temp.Tables[0]; //assign the return dataset (the first DataTable)
GridView1Search.DataBind(); //binding stuff
After that my GridView is show all the records that dataset contains
My first problem is that one of the columns contains as data a link and I want to make it a link (that's it to press it and load a http page).
Is there any way to do it?
My second problem is that when I add a statement:
GridView1Search.AllowSorting = true;
And I push the field header in order to sort by field, an exception is thrown. Take a look:
The GridView 'GridView1Search' fired event Sorting which wasn't handled.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The GridView 'GridView1Search' fired event Sorting which wasn't handled.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The GridView 'GridView1Search' fired event Sorting which wasn't handled.]
System.Web.UI.WebControls.GridView.OnSorting(GridViewSortEventArgs e) +236
System.Web.UI.WebControls.GridView.HandleSort(String sortExpression, SortDirection sortDirection) +77
System.Web.UI.WebControls.GridView.HandleSort(String sortExpression) +71
System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +545
System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +190
System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4919
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
So there is any way to make the sort work out ?