p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Professional (http://p2p.wrox.com/forumdisplay.php?f=57)
-   -   need help (http://p2p.wrox.com/showthread.php?t=40423)

msathyaprasad90 March 27th, 2006 11:02 AM

need help
 
 Hi Friend(s).,
I am working in a project.in that project i am using data grid to display contents from a table. I have used two drop down lists in header of two columns. For first time page was loaded i need to display all the information in data source .If user was selected any value from any one of drop down information depends on that value is to be displayed. I used paging, for first time all the contents are displayed. But after selecting a value from drop down and click on the next page all the information is displaying .

how to solve this problem.

Give me suggestions


dparsons March 28th, 2006 12:03 AM

I assume that you are filtering your data based on the Dropdownlist selection. What you have to do is set up your dropdownlists to autopostback and in the method that handles those postbacks call a method that will repopulate your datagrid. Hope this helps.

"The one language all programmers understand is profanity."

msathyaprasad90 March 29th, 2006 01:57 PM

I HAVE ALREADY USED AUTO POST BACK FOR DROP DOWN I AM GETTING THE RESULT. BUT WHEN I GO FOR PAGING I AM GETTING ALL THE INFORMATION THAT MAY NOT MATCH WITH DROPDOWN LIST

SUGGEST ME THE WAY



dparsons March 29th, 2006 03:45 PM

in your page load method do you call databind() on the datagrid and then call it again in your postback method?

"The one language all programmers understand is profanity."

msathyaprasad90 March 31st, 2006 01:31 AM

Yes. I had used databind() method for three times
1) For first time i used in page_load() to show all the data

2) For second time i used in a function that will handle first drop dowm
list. But i used same DataGrid. Then i am getting data that is filtered on drop down. But when i click on the pager button i am getting all the data, which i got for first time and also this data is not filtered and does not depend on the drop down list selection.

3)For third time i used databind() method in another function to hadle second drop down list.But i used same DataGrid. Then i am getting data that is filtered on drop down. But when i click on the pager button i am getting all the data, which i got for first time and also this data is not filtered and does not depend on the drop down list selection.


madhusrp April 4th, 2006 09:04 AM

Store the conditions of the dropdown selected indexchanged event in an viewstate variable.in the event handler of pagechange of the datagrid write the code for databind with the viewstateconditions and also for the normal conditions if not understood i am sorry this is the better english i can perform

anyhow might this help you.
Madhu


madhusrp April 4th, 2006 09:45 AM

call databind function in the pageindexedchange event handler with the conditions of the dropdown values. for example

designergenerated code add this

this.datagrid.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEvent Handler(this.Page_Change);


private void Page_Change(object source, System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
        {
            Datagrid.CurrentPageIndex = e.NewPageIndex;

            if (ViewState["searchConditions"]!=null)
            {
                BindData((SearchConditions)ViewState["searchConditions"], true);
            }
            else
            {
                BindData(searchConditions, true);
            }
        }

probaably u might get changes the values to your datagridand bind conditions here viewstate is the dropdown conditions.


All times are GMT -4. The time now is 04:38 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.