473,594 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FindByText in dropdownlist

11 New Member
How to use FindByText property of dropdownlist where text to find is in a textbox? i.e

if i write,
dropdownlist1.I tems.FindByText (" ' "& txt1.Text &" ' ").Selected = True

i get error
System.NullRefe renceException: Object reference not set to an instance of an object
Feb 27 '07 #1
4 1869
kenobewan
4,871 Recognized Expert Specialist
Try putting txt1.text into a string, eg myString, writing it to ensure it has a value and then use:
Expand|Select|Wrap|Line Numbers
  1. dropdownlist1.Items.FindByText(myString).Selected = True
Feb 27 '07 #2
Aneri
11 New Member
Try putting txt1.text into a string, eg myString, writing it to ensure it has a value and then use:
Expand|Select|Wrap|Line Numbers
  1. dropdownlist1.Items.FindByText(myString).Selected = True




It's not working.Getting the same error.
Feb 28 '07 #3
kenobewan
4,871 Recognized Expert Specialist
Write myString...
Feb 28 '07 #4
Aneri
11 New Member
Write myString...

I tried by writing:

dim myString as string
myString = txt1.Text
dropdownlist1.F indByText(myStr ing).Selected = True

But Getting the same error.
Feb 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
2774
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option Description"></asp:BoundColumn> <asp:TemplateColumn runat="server" HeaderText="Id Type Option" "> <itemtemplate> <asp:label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TypeOption") %>' /> <asp:label runat="server" ID="LlbTypeOption" Visible=False...
2
16989
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of the columns of the data grid contains a DropDownlist. I managed to create this datagrid control as follows.
2
2156
by: acko bogicevic | last post by:
I have combobox which is filled from database. Afterwords i will get a criteria for searching a combo by value. Hao can i make item in combo to be selected when value in combo match critiria. Thanks *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
0
1446
by: Thomas Scheiderich | last post by:
I have a screen that is trying to search a listbox both by FindByText and FindByValue. The FindByValue is working find, but the FindByText is not finding anything. This is even if I copy the text directly from the source page and paste it into the textbox to make sure I have no typos. Here is the screen: ******************************************************************* <%@Page Explicit="True" Language="VB" Debug="True" %>
0
993
by: Mark | last post by:
I have a dropdownlist that is dynamically populated. I want to make one of the items be selected by default based on PART of the text that is displayed. However, the FindByText method of the dropdownlist is looking for a complete match. Aside from iterating through the entire collection of list items, is there an easier way to find the matching item, and then select it? Thanks in advance. Mark
3
10140
by: AK | last post by:
Hi, I am using FindByText method of dropdownlist to change the selected item in a dropdownlist like this: DropDownList1.Items("mySelectedText").Selected = True It doesn't seem to be doing the trick. I have this piece of code in OnSelectedIndexChanged event of the dropdownlist. Can anyone tell me why it's not setting the selected item?
2
3192
by: | last post by:
Hi, is it FindByText case Sensitive? How to set it to case insensitive? Thanks in advance.
6
7325
by: prpleprncs | last post by:
I have a dropdownlist that is selected on page_load. the values of the dropdown comes from the database using a datasource at design time. the value that needs to be selected comes from the database also. I have tried everything in the world to get the page to load without the System.NullReferenceException: Object reference not set to an instance of an object. I ahve used the trim functions for any possible paddings (there were some). I...
0
1932
by: asmx126453 | last post by:
Hey mensen I am having some big troubles here i tryd solving it myself with internet for 2 days but i kind fix it. Its about this i have a DotNet project that alrydi is online and working for almost everything. but it whas made in Visual Studio 7 and i converted it to 2005. in version 7 it works almost perfect but in 2005 i am having some errors. becase all the code i am using is very long i am trying to post the nesecery code only if...
0
7946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7877
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8253
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8240
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5739
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5411
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2389
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 we have to send another system
1
1482
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.