0

This may not be possible but thought i would ask. Creating a Sharepoint webpart. In the ascx file i have a style tag. Is there any way that i could do the following:

    <style type="text/css">
    outerDiv
    {        
       border: 1px solid Black;
       height:<%# webPartHeight %>;
       width:300px;
    }
</style>

where the value for height is set via a data binding expression (code behind property). I tried it and when i inspected the style the height had no value set. Any help appreciated either way :)

1 Answer 1

1

Just call DataBind() in, say, Page_Load and it will bind your properties to the page and you can use the exact syntax you have there.

protected string webPartHeight { get; set; }
protected void Page_Load(Object sender, EventArgs e)
{
    webPartHeight = "400px";
    DataBind();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.