Using user controls in datagrids


G

Guest

I was wondering if anybody in this forum has tried the following:

<edititemtemplate>
<uc1:department_dropdown id="Department_dropdown2"
runat="server"></uc1:department_dropdown>
</edititemtemplate>

This produces a dropdown and then when a user goes to update I have the
following code.


str_emp_dept =
Convert.ToString(((DropDownList)e.Item.FindControl(Department_dropdown2.Selected_dept_value())));


Howerver, I keep getting the following



Server Error in '/WOW' Application.
--------------------------------------------------------------------------------

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:

Line 18: public string Selected_dept_value()
Line 19: {
Line 20: string dept_value = dept_dropdown.SelectedValue;
Line 21: return dept_value;
Line 22: }




I know my user control works because I use it when inserting new names. Any
help would be most helpful.
--------------------------------------------------------------------------------
Moojjoo Õ¿Õ


http://www.mmwebs.com


http://www.autoinventoryonline.com/
 
Ad

Advertisements

G

Guest

More infor:

When debugging, I am watching the locals and it indicates
Department_dropdown2 value = <undefined>

I am a bit confused because when the page builds it does displays the
correct values in the dropdown but will not get the values?

I am scrathing my head on this one.
 
Ad

Advertisements


Top