populating ASP.NET website Data Grid View dynamically based on text input parameter

I have built a concept 3-tier application that consists a back-end data store (SQL Server 2005), a middle tier Web Service and ASP.NET front end.

I am trying to create a front-end that has the following capability:

I should be able to input a "customer identification number" via a text box. Once I click the "submit" button, It should navigate to another asp page and then display a data grid view based on data set returned by a middle tier web method based on the my given input parameter that the web method takes in the previous page from the text input.

Do I need to worry about states in this scenario? If yes, would it be the value of the inputted into the text box ?

In the second page, can I still configure the data grid view using the wizard or do I need to do it programatically, since the input parameter of we the web service method is set during run time ?

Thanks.


scarface7Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

YZlatCommented:
create a DataView and set DataSource property of the DataGrid to the DataView.

Then, on click of a button, set RowFilter property of the dataview to equal "CustomerID='" & TextBox1.text & "'"
and then Bind your datagrid
0
YZlatCommented:
Public dv As DataView

dv= New DataView(ds.Tables(0))
DataGrid1.DataSource=dv
DataGrid1.DataBind()

Then on click of a button do something like this:
dv.RowFilter="CustomerID='" & TextBox1.Text & "'"
DataGrid1.DataSource = dv
DataGrid1.DataBind()
0
scarface7Author Commented:
Thanks for your response.

1) The first 3 lines of code you provided.... does that go into the 2nd page (where the datagrid is displayed) ?

2) The last 3 lines of the code you provided... goes on the "on click" method of the button on the 1st page ?

3) So there is no "states" involved in this situation ?

I am coding in C#.



0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

YZlatCommented:
yes, you are correct.

Here is C# code:

DataView dv;
dv = new DataView(ds.Tables[0]);
DataGrid1.DataSource = dv;
DataGrid1.DataBind();


    dv.RowFilter = ("CustomerID=\'"
                + (TextBox1.Text + "\'"));
    DataGrid1.DataSource = dv;
    DataGrid1.DataBind();

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
YZlatCommented:
post the code where you polpulate your datagrid
0
scarface7Author Commented:
I figured out how to move values from one page to the other.

I could either use Cross page posting new to .NET 2.0 or Sessions.

Thank you for help with respect to programmatically bind the data to a data grid view.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.