Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 27th, 2006, 11:02 AM
Authorized User
 
Join Date: Mar 2006
Location: CHENNAI, TN, India.
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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

  #2 (permalink)  
Old March 28th, 2006, 12:03 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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."
  #3 (permalink)  
Old March 29th, 2006, 01:57 PM
Authorized User
 
Join Date: Mar 2006
Location: CHENNAI, TN, India.
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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


  #4 (permalink)  
Old March 29th, 2006, 03:45 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

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."
  #5 (permalink)  
Old March 31st, 2006, 01:31 AM
Authorized User
 
Join Date: Mar 2006
Location: CHENNAI, TN, India.
Posts: 19
Thanks: 1
Thanked 0 Times in 0 Posts
Default

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.

  #6 (permalink)  
Old April 4th, 2006, 09:04 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #7 (permalink)  
Old April 4th, 2006, 09:45 AM
Authorized User
 
Join Date: Jan 2006
Location: Pittsburgh, PA 15203
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






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