Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
LISTBOX[]

I have a listbox named Products and its attribute SelectionMode="Multiple"
i binded listbox with stored procedure
and listbox has the following....
Listbox.datatextfield=ProductName;
Listbox.dataValuefield=ProductID;

when i selected multiple items in the Listbox it will valuefield to a
stored procedure named GetProductdetailsbyid(ProductID)

it will get ProductName,ProductID,ProductRate,ProductUnit.

I have to store that to datatable and bind in an repeater Control..

Can Any One Try this and give a solution?

You can try other controls like datalist,gridview...

Thank YOu
Posted
Updated 9-Jun-11 21:34pm
v4
Comments
RakeshMeena 10-Jun-11 3:33am    
Why anybody else should try this? BAD..... You try and post the challenge that you face.
sundarvil 10-Jun-11 3:36am    
I'm trying from past week itself.Still i did not able to find the solution. Tht's Y. I posted the question here
RakeshMeena 10-Jun-11 3:54am    
I commented because you said "Can Any One Try this and give a solution?"... Anyways try my answer, that might help you, if not please post the issue. We'll try to resolve it.

1 solution

Try below steps:
1. You need to change you SP "GetProductdetailsbyid(ProductID)", since the listbox is multiselect and hence you should be able to pass multiple product id's to your SP.
2. Retrieve the recordset from your SP in datatable and bind it to the repeater control. This link will help you to start with.
 
Share this answer
 
Comments
sundarvil 10-Jun-11 4:53am    
I'll try that today.... Can You try with the following Code.

protected void btnSelectItems_Click(object sender, EventArgs e)
{
int tot = Listbox1.Items.Count;
for (int x = 0; x < tot; x++)
{
if (Listbox1.Items[x].Selected.Equals(true))
{
Label1.Text = lstISRItems.Items[x].Value.ToString();
LoadSelectedItemsDetails(Label1.Text);
}
}
}
void LoadSelectedItems(ProductID)
{
DataTable dt= new DataTable();
BLLIssueSalesRoom objISR = new BLLIssueSalesRoom();//This will give link to the stored Procedure
dt = objISR.GetISRGetItems(Label1.Text);//this will call sp wit parameter
Repeater1.DataSource=dt;
Repeater1.DataBind();
}

Can u modify this?
yasar31 20-Dec-12 9:32am    
what is mean lstISRItem ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900