Add User Control to Grid
- 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.
- Register the control on the HTML page just after the Begin Panel Head.
- <%@ register tagprefix=”uc1″ tagname=”MyUserControl” src=”/dnn/Portals/9/my_user_control.ascx” %>
- Add the control in between table data tags (<td></td>).
- <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.