Bind a GridView to a Tree View node selection

J

JN

Hi All,

I have a tree view which has parent nodes of each letter of the alphabet. The root node will be the customers name that relate to the parent node letter.

I also have a gridview which is binded to the treeview control to display all customer records of the selected alphabetical letter.

When I click expand the tree view and click on the customer's name, I get this error.:

Please bear in mind that I have only been using ASP.net for a week.

Thanks for your help.
JN

Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.

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:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753507
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +257
System.Web.UI.WebControls.Parameter.get_ParameterValue() +92
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +282
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +344
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1250
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +84
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
System.Web.UI.WebControls.GridView.DataBind() +24
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +92
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +33
System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +74
System.Web.UI.Control.PreRenderRecursiveInternal() +148
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4435
 
P

Patrick.O.Ige

JN maybe try posting some snippet code.
Patrick

Hi All,

I have a tree view which has parent nodes of each letter of the alphabet. The root node will be the customers name that relate to the parent node letter.

I also have a gridview which is binded to the treeview control to display all customer records of the selected alphabetical letter.

When I click expand the tree view and click on the customer's name, I get this error.:

Please bear in mind that I have only been using ASP.net for a week.

Thanks for your help.
JN

Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.

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:

[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2753507
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +102
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +257
System.Web.UI.WebControls.Parameter.get_ParameterValue() +92
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +282
System.Web.UI.WebControls.SqlDataSourceView.InitializeParameters(DbCommand command, ParameterCollection parameters, IDictionary exclusionList) +344
System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1250
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +84
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +154
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +99
System.Web.UI.WebControls.GridView.DataBind() +24
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +92
System.Web.UI.WebControls.BaseDataBoundControl.OnPreRender(EventArgs e) +33
System.Web.UI.WebControls.GridView.OnPreRender(EventArgs e) +74
System.Web.UI.Control.PreRenderRecursiveInternal() +148
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Control.PreRenderRecursiveInternal() +233
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4435
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top