CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Listbox Value To populate Grid

Print topic Send  topic

Author Message
jofreder

Posts: 10
Posted: 11/23/2006, 9:26 PM

My Grid Is setup to get data from a stored procedure and takes one parameter. I need the parameter to come from a Listbox at the top of the page. So, how do I select from the listbox and populate my grid.

I am using .NET 2.0 C#

Thanks
View profile  Send private message
Diesel

Posts: 43
Posted: 11/30/2006, 1:23 AM

Hi there

Ok, so you have a Grid that is populated with a Stored Proc that gives a @Return_Value from which you get your columns and data. Now for your Stored Proc to work correctly you need to pass a parameter to the Stored Proc and then populate the grid accordingly.

Lets assume that the Listbox name is ListboxExample and the Form Name is GridForm

Therefore you need to add the following code on the onchange client-side event of the listbox:

reload_page();

The code for this function must be put in the header part of your page:

function reload_page() {
var sel_index = theForm.GridFormListboxExample.options[theForm.GridFormListboxExample.selectedIndex].value;
if (sel_index != "") {
document.location.href = document.location.pathname + "?" + "ListboxExample=" + sel_index;
}
}

What happens when doing this?

You pass the value of the listbox that you need for the grid to the url which can now be picked up from the Stored Proc in the Grid.

How?

Create a new parameter in the DataSource where you have your Stored Proc @Return_Value
Depending on the datatype the parameter settings will differ. I am going to assume that the value is an integer.

Thus:
Stored Procedure Parameter
Parameter Name: @ListboxExample
Data Type: Integer
Data size: 0
Direction: Input
Scale: 0
Precision: 10

Parameter
Parameter Name: ListboxExample
Data Type: URL
Format:

Thats it! Compile and it works!
Zack
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.