0

Is it possible to set the a gridview's headerrow property from the aspx code? I'd like to be able to include extra controls to the header such as textbox for filter. I can do this from the C# code behind by dynamically adding the controls, but doing this seems to introduce some suitable problems that I'd rather avoid.

1 Answer 1

3

Use a header template field.

<columns>
    <asp:templatefield>
        <headerstyle backcolor="Navy" forecolor="White"/>
        <headertemplate>
            <asp:textbox id="txtFilter" runat="server"/>
        </headertemplate>
    </asp:templatefield>                      
</columns>

See here.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Completely missed that.

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.