Add User Control to Grid

  1. Create the User Control in Visual Studio.  In my example it was a simple DropDownList that had AutoPostBack set to True and redirected to another page on postback with a value from the grid.
  2. Register the control on the HTML page just after the Begin Panel Head.
  3. <%@ register tagprefix=”uc1″ tagname=”MyUserControl” src=”/dnn/Portals/9/my_user_control.ascx” %>
  4. Add the control in between table data tags (<td></td>).
  5. <td><uc1:MyUserControl id=”StudentActionDL” runat=”server” studentid='<%# Student.DataItem(“StudentID”) %>’ examrequestaddpage=”exam_request_form.aspx” /></td>

Student = the grid name

studentid = a public property in the user control.  You need to save the value to a hidden field if you need it on postback.

StudentID is one of the fields selected from the database.

examrequestaddpage is another public property of the control.