?
Solved

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

Posted on 2006-04-11
6
Medium Priority
?
323 Views
Last Modified: 2012-06-22
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.


0
Comment
Question by:scarface7
  • 4
  • 2
6 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 16430126
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
 
LVL 35

Expert Comment

by:YZlat
ID: 16430432
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
 

Author Comment

by:scarface7
ID: 16431318
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 35

Accepted Solution

by:
YZlat earned 1500 total points
ID: 16436684
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
 
LVL 35

Expert Comment

by:YZlat
ID: 16438099
post the code where you polpulate your datagrid
0
 

Author Comment

by:scarface7
ID: 16446958
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question