Hello,
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
Thank You, 5 1443
Well! If you bind your dropdownlist to your ODS and its items count property
is zero, then can't you go ahead and set its visibility to false based on
that?
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
Hello,
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
Thank You,
The problem is there for me.
First of all I am new to asp.net as you may have noticed. And secondly
there is not such a method like:
ObjectDataSource.Items.Count
that's why I'm stuck.
Peter wrote:
Well! If you bind your dropdownlist to your ODS and its items count property
is zero, then can't you go ahead and set its visibility to false based on
that?
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
Hello,
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
Thank You,
Yep. I didn't say you should be checking for an Items collection property on
your ObjectDataSource. I said to check it on the dropdownlist, which does
have an Items collection.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
The problem is there for me.
First of all I am new to asp.net as you may have noticed. And secondly
there is not such a method like:
ObjectDataSource.Items.Count
that's why I'm stuck.
Peter wrote:
Well! If you bind your dropdownlist to your ODS and its items count property
is zero, then can't you go ahead and set its visibility to false based on
that?
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
Hello,
>
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
>
Thank You,
>
>
I had already tried what you said but it hadn't worked either. But now
I got why it didnt work.
Because the dropDownList is databinded, and it doesn't contain any info
on every Page_Load it always returned 0 for list.items.count..
my fault was writing that code in page_load function.
Now I changed it to:
Protected Sub DropDownList1_DataBound(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DropDownList1.DataBound
If DropDownList1.Items.Count.Equals(0) Then
DropDownList1.Visible = False
End If
End Sub
and it works fine..
thank you anyway for your help..
Peter wrote:
Yep. I didn't say you should be checking for an Items collection property on
your ObjectDataSource. I said to check it on the dropdownlist, which does
have an Items collection.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
The problem is there for me.
First of all I am new to asp.net as you may have noticed. And secondly
there is not such a method like:
ObjectDataSource.Items.Count
that's why I'm stuck.
Peter wrote:
Well! If you bind your dropdownlist to your ODS and its items count property
is zero, then can't you go ahead and set its visibility to false based on
that?
Peter
>
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
>
>
>
>
"Dot Net Daddy" wrote:
>
Hello,
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
Thank You,
Whatever "floats yer boat"! Works for me.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
I had already tried what you said but it hadn't worked either. But now
I got why it didnt work.
Because the dropDownList is databinded, and it doesn't contain any info
on every Page_Load it always returned 0 for list.items.count..
my fault was writing that code in page_load function.
Now I changed it to:
Protected Sub DropDownList1_DataBound(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DropDownList1.DataBound
If DropDownList1.Items.Count.Equals(0) Then
DropDownList1.Visible = False
End If
End Sub
and it works fine..
thank you anyway for your help..
Peter wrote:
Yep. I didn't say you should be checking for an Items collection property on
your ObjectDataSource. I said to check it on the dropdownlist, which does
have an Items collection.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
The problem is there for me.
>
First of all I am new to asp.net as you may have noticed. And secondly
there is not such a method like:
>
ObjectDataSource.Items.Count
>
that's why I'm stuck.
>
>
Peter wrote:
Well! If you bind your dropdownlist to your ODS and its items count property
is zero, then can't you go ahead and set its visibility to false based on
that?
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dot Net Daddy" wrote:
Hello,
>
I have an objectDateSource. But sometime there might not be any data
for my application. So how can I know if the objectDataSource has no
data? I binded a dropdownlist to this objectDataSource and I want to
set the dropdownlist.visible = False, if there is no data.
>
Thank You,
>
>
>
>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jim Hammond |
last post by:
I am passing the whole object instead or parameters in my select and update
methods.
I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate
an update button, and then press...
|
by: Ole M |
last post by:
I'm having some trouble using the ObjectDataSource in ASP.NET 2.0.
I have a wrapper that contains the static methods for Select and Update. The
Update-method takes the business object as...
|
by: Jim Hammond |
last post by:
It would be udeful to be able to get the current on-screen values from a
FormView that is databound to an ObjectDataSource by using a callback instead
of a postback. For example:
public void...
|
by: J055 |
last post by:
Hi
I've implemented caching for my ObjectDataSource.
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
EnableCaching="True" CacheDuration="10" CacheExpirationPolicy="Sliding"
...
|
by: J055 |
last post by:
Hi
I've been trying out SqlCacheDependency using the ObjectDataSource and SQL
Server 2005. It all works quite well with the minimum of configuration, e.g.
<asp:ObjectDataSource...
|
by: Rolf Welskes |
last post by:
Hello,
I have an ObjectDataSource which has as business-object a simple array of
strings. No problem.
I have an own (custom) control to which I give the DataSourceId and in the
custom-control...
|
by: Randy Smith |
last post by:
Hi ALL,
I wonder if anyone has been using n-tier to bind to a GridView control by
using the ObjectDataSource. This is our first OOP web application, and we
have no tables. Right now we are...
|
by: =?Utf-8?B?cm9zczYxMw==?= |
last post by:
I really hope this is not a case of "this silly thing will never
work".....lots of time invested in troubleshooting this already.
I have created a standard ASP.NET web form (.aspx) with several...
|
by: =?Utf-8?B?RGVuaXMgU29oZXQ=?= |
last post by:
Hi all,
I've created a new project to test ObjectDataSource component.
I've just added a new objectdatasource, configured it (linked to a table)
etc ...
It works fine on localhost, i can...
|
by: Max2006 |
last post by:
Hi,
I am truing to find a pattern for my Business Logic Layer to be able to work
fine win ObjectDataSource's Update method.
The challenge is ObjectDataSource is not able to work with an...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |