471,120 Members | 1,382 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,120 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 1193
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Victor Jones | last post: by
reply views Thread by Victor Jones | last post: by
reply views Thread by Jason S | last post: by
2 posts views Thread by Al Smith | last post: by
2 posts views Thread by Shane | last post: by
9 posts views Thread by Dennis | last post: by
5 posts views Thread by Mark R. Dawson | last post: by
1 post views Thread by Zak Lomakus | last post: by

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.