473,466 Members | 1,394 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

exclude dinamic value from listbox

I have a listbox which is populated from Sql query and I use it to add
values to table. I would like to exclude value which just has been
added from listbox. Since it is impossible to do in query which is
datasource for query is there some other option.

Jun 22 '07 #1
2 1635
Hi Mirnes,

You have to handle DataBound of the ListBox event and remove whatever you
don't need:

protected void ListBox1_DataBound(object sender, EventArgs e)
{
ListBox listBox = (ListBox)sender;
// there are two methods you can use
//ListItem listItem = listBox.Items.FindByText("ItemText");
// or
ListItem listItem = listBox.Items.FindByValue("3");
if (listItem != null)
{
listBox.Items.Remove(listItem);
}
}
hope this helps
--
Milosz
"Mirnes" wrote:
I have a listbox which is populated from Sql query and I use it to add
values to table. I would like to exclude value which just has been
added from listbox. Since it is impossible to do in query which is
datasource for query is there some other option.

Jun 22 '07 #2
Thanks for response, I'll try this.
Milosz Skalecki [ MCAD ] je napisao:
Hi Mirnes,

You have to handle DataBound of the ListBox event and remove whatever you
don't need:

protected void ListBox1_DataBound(object sender, EventArgs e)
{
ListBox listBox = (ListBox)sender;
// there are two methods you can use
//ListItem listItem = listBox.Items.FindByText("ItemText");
// or
ListItem listItem = listBox.Items.FindByValue("3");
if (listItem != null)
{
listBox.Items.Remove(listItem);
}
}
hope this helps
--
Milosz
"Mirnes" wrote:
I have a listbox which is populated from Sql query and I use it to add
values to table. I would like to exclude value which just has been
added from listbox. Since it is impossible to do in query which is
datasource for query is there some other option.
Jun 25 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dddddd | last post by:
i need do create simple dinamic site - built mainly of pictures(they are the only dinamic part). pictuers differ by the -Location- and by -Time- (in which they were taken)... so on the index...
3
by: Jose Garcia | last post by:
Hi there, Can somebody explain me how can i use matrixes with dinamic memory? I use malloc and free (NOT new & delete). I want to access to the matrix like Matrix but i don't know how to do that...
6
by: gp | last post by:
Hi all, I'm using Microsoft Visual C++ 6.0, I would like to see, debugging my project, all the elements of my dinamic objects.... I have a dinamic array and a STL vector and I need to know...
2
by: Remco Groot Beumer | last post by:
Hello, I created a program in which I use modules and classmodules for setting my variables. For example when I need to set the customerID in a variable I use something like: ...
2
by: Allan Horwitz | last post by:
When I try to reference the lstproducts.selecteditem.value using autopostback from the lstproducts listbox I get an error? How can I fix my code to get the selected value from the lstproducts...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
3
by: Gabe Matteson | last post by:
How would I go about excluding a list of specific directories in a listbox from being queried using the following code? Any ideas? Thank you. Private Sub rAllStats(ByVal sDir As String) Try ...
2
by: php_Boi | last post by:
i have designed an application that is a dynamic submission form. i have text fields and listboxes. now i am able to retain the values of the listboxes when i populate the listbox "manually"(single...
10
by: Simon Brooke | last post by:
I'm struggling to understand what 'exclude-result-prefixes' does and is for; the language of the standard http://www.zvon.org/xxl/XSLTreference/W3C/xslt.html#literal-result-element is not...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.