GridView - binding data programmatically

B

bsaran

Hi, I have a code that sort of works. The event flow is as follows:
In a user control of type "FilterControl" user selects certain values
from 3 related dropdown lists. (two of them have auto postback set to
true as I need to refresh the 2nd and 3rd list. Then clicks on Submit
button which fires a custom event "FilterSubmitted". Yes this a custom
control, as I will be using it in many places.

I have a GridView control on the page that displays the search results.

The problem is that when the 1st filter is selected, the postback
causes the page to refresh together with the GridView, which I would
like to keep unchanged until the Submit button of the FilterControl.

All stopping of the events in DataBound related evens using flags had
the same behaviour.

I have tried to remove the code from aspx to the code behind, where I
hit the following error
"Value cannot be null.\r\nParameter name: propName".
My understanding is that this is related to the Data Access Security
aspect.
As per MSDN - the "User" value is set correctly for the page.
I have no clue as to what to do next.

Is there any other way to stop the page from being refreshed?
How could I use client side refresh of the filter, such that the post
back only occurs on Submit button?

Any guidance would be greatly appreciated.

Thanks
bsaran

Below is the Stack Trace for consideration:
System.ArgumentNullException was unhandled by user code
Message="Value cannot be null.\r\nParameter name: propName"
Source="System.Web"
ParamName="propName"
StackTrace:
at System.Web.UI.DataBinder.GetPropertyValue(Object container,
String propName)
at
System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable
dataSource, Boolean dataBinding)
at
System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable
data)
at
System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
at
System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable
data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments
arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at System.Web.UI.WebControls.GridView.DataBind()
at Pricing_PriceRebate.Filter_Submitted(Object sender,
FilterSubmitEventArgs e) in
c:\Dev\Projects\GainShare.root\GainShare\GainShare\Pricing\PricingInput.aspx.cs:line
122
at
UserControls_FilterControl.OnFilterSubmit(FilterSubmitEventArgs e) in
c:\Dev\Projects\GainShare.root\GainShare\GainShare\UserControls\FilterControl.ascx.cs:line
49
at UserControls_FilterControl.btnSubmit_Click(Object sender,
EventArgs e) in
c:\Dev\Projects\GainShare.root\GainShare\GainShare\UserControls\FilterControl.ascx.cs:line
118
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument)
at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection
postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
 

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

Top