By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,869 Members | 1,742 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,869 IT Pros & Developers. It's quick & easy.

Custom Server Control and DataGrid Issue.

P: n/a
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-
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

"Sam Samnah" <we**********@terraquest123.ca> wrote in
news:OS**************@TK2MSFTNGP15.phx.gbl:
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-


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.