Custom Server Control and DataGrid Issue.

S

Sam Samnah

Hi Everyone.

It has been a long time since my last post. Nevertheless, I have built a
custom server control that allows a user to edit text, bolding, italics
strike though table insertion and manipulation etc etc. The control works
perfectly when placed outside a templated control but when placed in, for
instance, a datagrid EditItemTemplate, I get the following error on the
DataBind Method: the dreaded "Object not set to a referance" or something to
that effect. I suspected the problem was that the custom server control was
not available until a user selects to edit the specific DataGrid index so I
filled a dataview and set the custom server control to implement the
dataview but that didn't work.

Anywho, anyone have any suggestions to correct this problem?

PS. The datagrid binds alright when the custom control isn't placed in the
datagrid.

I am Sam-
 
C

cbDevelopment

My best guess on the description is that you are trying to access a
property in this custom control in a template that does not contain the
control.

For example, you put the control in the EditItemTemplate, but in the
databind event, there is code like:

dim c as theCustomControl
c=e.item.findcontrol("CC")
c.visible=true

Without being like:

if e.item.itemtype=EditItem then
... The same code
end if

So when the DataBinding handler is processing a Item or AlternatingItem
(or Header or Footer) row, it is trying to get a reference to the control
that is not in that template.

Hope that's an accurate guess.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top