Personally I hate using these user controls, as you lose a certain amount of control. I set up as eg:
In ASPX file
<div id="UserName" name="UserName2" runat="server"></div>
<div id="InBox" name="UserName2" runat="server"></div>
Then in my code behind I would have:
public class _default : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlGenericControl UserName;
protected System.Web.UI.HtmlControls.HtmlGenericControl InBox;
private void Page_Load(object sender, System.EventArgs e)
{
//.. do DB query
UserName.InnerHTML = "whatever from DB";
InBox.InnerHTML = "whatever from DB";
// Can now squirt my DB data into anything else on the page as well, without doing another query
}
}
__________________
Steve
|