472,992 Members | 3,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,992 software developers and data experts.

databinding question

I haven't been able to find a clear answer to this and I'm hoping someone
could enlighten me.

As pertains to databinding a control in a repeating fashion(datagrid,
repeater, etc.) what event would one handle to get a handle on things just
BEFORE the data is bound. To be clearer, not controlling the formatting of
the bound control(backcolor or what have you), but rather control the WAYor
even IF the data is bound at all.

For instance, in the context of active directory calls some results come
back in a non deterministic way. In one result of an ADSI query I could
have an item with a "phonenumber" property and the very next result could
have no such property. It simply isn't present. Kind of like a ragged
array I guess you could say. When the databinder gets to that entry it
throws an index out of range exception/COM exception, etc.

So back to my question... what event allows me to come in BEFORE the data is
bound and have the bindee dataitem there for inspection? Essentially,
control the entire process. It appears that ItemDataBound is after the fact
and is merely for tidying up. I couldn't tell if the DataBinding event or
the ItemCreated would help me get closer or not. They way I am working with
it now is by page level databinding statements such as:

<%#
((SearchResult)Container.DataItem).Properties.Cont ains("telephonenumber") ?
((SearchResult)Container.DataItem).Properties["telephonenumber"][0] :
"[blank]" %>

What is the code level equivalent of this action? This seems like such a
common thing to do but I can't find a good description of the process.

TIA,
Jason S.
Nov 18 '05 #1
4 1267
Hi Jason,

If I understand you question properly you want to verify the data row by row
before it is bound. that's exactly what the ItemDataBound even is for. you
can get the event and check for the data that would appear you would need to
keep a copy of the data handy even in view state or in the cache to know
which row is supposed to go there

I hope this makes sense and helps you

Cheers Tim
"Jason S" <so*****@somewhere.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
I haven't been able to find a clear answer to this and I'm hoping someone
could enlighten me.

As pertains to databinding a control in a repeating fashion(datagrid,
repeater, etc.) what event would one handle to get a handle on things just
BEFORE the data is bound. To be clearer, not controlling the formatting of the bound control(backcolor or what have you), but rather control the WAYor even IF the data is bound at all.

For instance, in the context of active directory calls some results come
back in a non deterministic way. In one result of an ADSI query I could
have an item with a "phonenumber" property and the very next result could
have no such property. It simply isn't present. Kind of like a ragged
array I guess you could say. When the databinder gets to that entry it
throws an index out of range exception/COM exception, etc.

So back to my question... what event allows me to come in BEFORE the data is bound and have the bindee dataitem there for inspection? Essentially,
control the entire process. It appears that ItemDataBound is after the fact and is merely for tidying up. I couldn't tell if the DataBinding event or
the ItemCreated would help me get closer or not. They way I am working with it now is by page level databinding statements such as:

<%#
((SearchResult)Container.DataItem).Properties.Cont ains("telephonenumber") ? ((SearchResult)Container.DataItem).Properties["telephonenumber"][0] :
"[blank]" %>

What is the code level equivalent of this action? This seems like such a
common thing to do but I can't find a good description of the process.

TIA,
Jason S.

Nov 18 '05 #2
Hatim,

Thanks for your reply. Does that event fire before or after the data is
bound to the control?

Thanks,
Jason S.

"Hatim R" <ha******@hotmail.com> wrote in message
news:zP********************@news04.bloor.is.net.ca ble.rogers.com...
Hi Jason,

If I understand you question properly you want to verify the data row by row before it is bound. that's exactly what the ItemDataBound even is for. you
can get the event and check for the data that would appear you would need to keep a copy of the data handy even in view state or in the cache to know
which row is supposed to go there

I hope this makes sense and helps you

Cheers Tim
"Jason S" <so*****@somewhere.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
I haven't been able to find a clear answer to this and I'm hoping someone could enlighten me.

As pertains to databinding a control in a repeating fashion(datagrid,
repeater, etc.) what event would one handle to get a handle on things just BEFORE the data is bound. To be clearer, not controlling the formatting of
the bound control(backcolor or what have you), but rather control the

WAYor
even IF the data is bound at all.

For instance, in the context of active directory calls some results come
back in a non deterministic way. In one result of an ADSI query I could
have an item with a "phonenumber" property and the very next result could have no such property. It simply isn't present. Kind of like a ragged
array I guess you could say. When the databinder gets to that entry it
throws an index out of range exception/COM exception, etc.

So back to my question... what event allows me to come in BEFORE the data is
bound and have the bindee dataitem there for inspection? Essentially,
control the entire process. It appears that ItemDataBound is after the fact
and is merely for tidying up. I couldn't tell if the DataBinding event

or the ItemCreated would help me get closer or not. They way I am working

with
it now is by page level databinding statements such as:

<%#
((SearchResult)Container.DataItem).Properties.Cont ains("telephonenumber") ?
((SearchResult)Container.DataItem).Properties["telephonenumber"][0] :
"[blank]" %>

What is the code level equivalent of this action? This seems like such

a common thing to do but I can't find a good description of the process.

TIA,
Jason S.


Nov 18 '05 #3
The ItemDataBound event is raised after an item is data
bound to the Databoundable control. This event provides
you with the last opportunity to access the data item
before it is displayed on the client. After this event is
raised, the data item is nulled out and no longer
available.

Bin Song, MCP
-----Original Message-----
Hatim,

Thanks for your reply. Does that event fire before or after the data isbound to the control?

Thanks,
Jason S.

"Hatim R" <ha******@hotmail.com> wrote in message
news:zP1Ab.69210 $Y*********@news04.bloor.is.net.cable.rogers.com.. .
Hi Jason,

If I understand you question properly you want to verify the data row byrow
before it is bound. that's exactly what the ItemDataBound even is for. you can get the event and check for the data that would appear you would need
to
keep a copy of the data handy even in view state or in
the cache to know which row is supposed to go there

I hope this makes sense and helps you

Cheers Tim
"Jason S" <so*****@somewhere.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
> I haven't been able to find a clear answer to this and I'm hopingsomeone > could enlighten me.
>
> As pertains to databinding a control in a repeating
fashion(datagrid, > repeater, etc.) what event would one handle to get a handle on things
just > BEFORE the data is bound. To be clearer, not
controlling the formatting
of
> the bound control(backcolor or what have you), but
rather control the WAYor
> even IF the data is bound at all.
>
> For instance, in the context of active directory
calls some results come > back in a non deterministic way. In one result of an ADSI query I could > have an item with a "phonenumber" property and the very next result
could > have no such property. It simply isn't present.
Kind of like a ragged > array I guess you could say. When the databinder gets to that entry it > throws an index out of range exception/COM exception, etc. >
> So back to my question... what event allows me to come in BEFORE the
data
is
> bound and have the bindee dataitem there for
inspection? Essentially, > control the entire process. It appears that ItemDataBound is after the fact
> and is merely for tidying up. I couldn't tell if the
DataBinding eventor > the ItemCreated would help me get closer or not.
They way I am working with
> it now is by page level databinding statements such
as: >
> <%#
>
((SearchResult)Container.DataItem).Properties.Con tains

("telephonenumber") ?
> ((SearchResult)Container.DataItem).Properties ["telephonenumber"][0] : > "[blank]" %>
>
> What is the code level equivalent of this action? This seems like sucha > common thing to do but I can't find a good

description of the process. >
> TIA,
> Jason S.
>
>


.

Nov 18 '05 #4
I suspected as much. That is not what I need.

Jason S.

"Bin Song" <an*******@discussions.microsoft.com> wrote in message
news:dc****************************@phx.gbl...
The ItemDataBound event is raised after an item is data
bound to the Databoundable control. This event provides
you with the last opportunity to access the data item
before it is displayed on the client. After this event is
raised, the data item is nulled out and no longer
available.

Bin Song, MCP
-----Original Message-----
Hatim,

Thanks for your reply. Does that event fire before or

after the data is
bound to the control?

Thanks,
Jason S.

"Hatim R" <ha******@hotmail.com> wrote in message
news:zP1Ab.69210

$Y*********@news04.bloor.is.net.cable.rogers.com.. .
Hi Jason,

If I understand you question properly you want to verify the data row by
row
before it is bound. that's exactly what the

ItemDataBound even is for. you can get the event and check for the data that would appear you would need
to
keep a copy of the data handy even in view state or in

the cache to know which row is supposed to go there

I hope this makes sense and helps you

Cheers Tim
"Jason S" <so*****@somewhere.com> wrote in message
news:OP**************@TK2MSFTNGP11.phx.gbl...
> I haven't been able to find a clear answer to this and I'm hoping
someone
> could enlighten me.
>
> As pertains to databinding a control in a repeating

fashion(datagrid, > repeater, etc.) what event would one handle to get a handle on things
just
> BEFORE the data is bound. To be clearer, not

controlling the formatting of
> the bound control(backcolor or what have you), but rather control the WAYor
> even IF the data is bound at all.
>
> For instance, in the context of active directory calls some results come > back in a non deterministic way. In one result of an ADSI query I could > have an item with a "phonenumber" property and the very next result
could
> have no such property. It simply isn't present.

Kind of like a ragged > array I guess you could say. When the databinder gets to that entry it > throws an index out of range exception/COM exception, etc. >
> So back to my question... what event allows me to come in BEFORE the
data
is
> bound and have the bindee dataitem there for

inspection? Essentially, > control the entire process. It appears that ItemDataBound is after the fact
> and is merely for tidying up. I couldn't tell if the DataBinding event
or
> the ItemCreated would help me get closer or not.

They way I am working with
> it now is by page level databinding statements such as: >
> <%#
>

((SearchResult)Container.DataItem).Properties.Con tains

("telephonenumber")
?
> ((SearchResult)Container.DataItem).Properties ["telephonenumber"][0] : > "[blank]" %>
>
> What is the code level equivalent of this action? This seems like such
a
> common thing to do but I can't find a good

description of the process. >
> TIA,
> Jason S.
>
>

.

Nov 18 '05 #5

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

Similar topics

0
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with...
0
by: Victor Jones | last post by:
I have a general question about the approach towards databinding controls with objects. Apart from the databinding offered by .NET to bind data, it can be extended to have the same behavior with...
0
by: Jason S | last post by:
I haven't been able to get an answer to this in the asp.net group, hoping someone here can enlighten me. As pertains to databinding a control in a repeating fashion(datagrid, repeater, etc.)...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
2
by: Al Smith | last post by:
I kind of understand how the below works, however I am trying to do it at runtime vrs design time. <asp:TextBox id="TextBox1" runat="server" Text='<%# StateList.SelectedItem.Text...
2
by: Shane | last post by:
When I click on the DataBinding in the properties window a list of options open up called Advanced,Tag and Text. I would like to know what Tag and Text are set to? I hope to Bind a text box to a...
9
by: Dennis | last post by:
I have tried using Databinding for my application but always seem to find it very restrictive (maybe I don't completely understand it enough). I always seem to find it much easier to display a...
5
by: Mark R. Dawson | last post by:
Hi all, I may be missing something with how databinding works but I have bound a datasource to a control and everything is great, the control updates to reflect the state of my datasource when I...
1
by: Zak Lomakus | last post by:
Hi, From my main page (default.aspx) I am calling another .aspx (e.g. otherpage.aspx) page through Javascript using window.showModalDialog. otherpage.aspx has a databoud control (webchart),...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.