473,498 Members | 1,633 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Binding NULL column causing Page_Load to run twice

Problem with page_load firing twice was driving me mad.
I had an aspx page with several webusercontrols in it.
One of them had a repeater with some databinders in it.
In my codebehing I bind a dataset to the repeater.
However when one of the values in my dataset (in my case field
'banLocation' holding the location of an banner) was a NULL value the
page was loaded a again after the databind() command. Just filling the
field in the table of my SQL server database with some value solved
the problem. Leaving the field NULL and removing the '' in the <IMG
SRC> tag solved it.

source of the webusercontrol:

<asp:repeater id="rptBanners" runat="server" EnableViewState="True">
<ItemTemplate>
<a href='click.aspx?id=<%#
Databinder.Eval(Container.DataItem,"banID") %>&url=<%#
Databinder.Eval(Container.DataItem,"banUrl") %>' target='<%#
Databinder.Eval(Container.DataItem,"banTarget") %>'>
<img src='<%# Databinder.Eval(Container.DataItem,"banLocation")
%>' border=0></a>
<asp:Label id="lblbanid" runat="server" Visible="False" Text='<%#
Databinder.Eval(Container.DataItem,"banID") %>'>
</asp:Label>
<br>
</ItemTemplate>
</asp:repeater>

codebehind:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim myConnection As New
SqlConnection(GetDBConnectionString)
Dim getbanners As New SqlDataAdapter("select * from
i_banners ", myConnection)
Dim banDS As New DataSet
getbanners.Fill(banDS)
Me.rptBanners.DataSource = banDS
Me.rptBanners.DataBind()
End If
End Sub
Nov 18 '05 #1
0 1099

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

Similar topics

26
45369
by: Agoston Bejo | last post by:
I want to enforce such a constraint on a column that would ensure that the values be all unique, but this wouldn't apply to NULL values. (I.e. there may be more than one NULL value in the column.)...
0
2813
by: Jim French | last post by:
I have a page that takes a comma delimited string and needs to bind to a Repeater control. The string is split into an Array, and each value is put into a DataBase query via a For Each loop. The...
4
1945
by: Brian Conway | last post by:
I need some help on binding a datareader to a dropdown box. I have included the code for the dropdown below. It builds with no errors, but returns no results. Any help would be appreciated. ...
5
3334
by: david | last post by:
I have a question in the following. Any one could give me a help? Thanks David The dataset is declared and created at Class level. My source code is here: Private Sub...
3
3465
by: Hans Merkl | last post by:
Hi, I was wondering if it's possible to bind the header text of a GridView column to a method of an object I have. At the moment I am setting the header texts in Page_Load but I was wondering if...
0
4776
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
9
4671
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
6
5716
by: p.mc | last post by:
Hi all, I'm having major problems with a userControl which contains a datagrid. My problem concerns data binding. The Page_Load() procedure calls the DataBind procedure to bind the datagrid...
4
2589
by: Mike | last post by:
I'm having trouble getting a gridview to bind. I probably missing something completely obvious and would appreciate any help on offer. I'm passing parameters via querystring, and have created a...
0
7125
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,...
0
7167
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
7208
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
4915
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
3095
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
3085
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1423
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 ...
1
657
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
292
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.