troubleshooting Question

Page_Load Manual bind Dropdownlist in gridview footer

Avatar of angelalaw
angelalawFlag for Afghanistan asked on
.NET ProgrammingC#ASP.NET
11 Comments1 Solution1917 ViewsLast Modified:
Hi all,

I am putting a dropdown in the footer of my grid with some creative <div>ing.

I need populate it and it is based off other control selections.

so for PAGE_LOAD

How can I manually populate a dropdrown in a gridview's footer?

I have tried it and it appears that the gridview has yet loaded when my code gets called.  there for it thinks the dropdown is null...

                        <div style="text-align:center;"><input id="chkAllBottom" onclick="return SelectAllCheckboxes(this);" runat="server" type="checkbox" /></div>
                        <div style="position:relative;top:-23px;left:600px;">
                            <table cellpadding = "0" cellspacing="0" border="0" width="350" class="selectedAction" style="position:absolute">
                                    <td valign="middle" width="150" align="left"><strong>With Selected</strong></td>
                                    <td valign="middle" width="150" align="right">
                                        <asp:DropDownList ID="_action" runat="server" EnableViewState="true"  />
                                    <td valign="middle" width="50" align="right">
                                        <asp:Button ID="btnGo" runat="server" Text="Go" />
CodeBehind being called from page_load
    protected void setAction()
        StringBuilder sSQL = new StringBuilder();
        sSQL.Append(" SELECT id=1, template_name='-- Choose Action --' UNION ");
        registration_tool RegTool = new registration_tool();
        DropDownList _action = ((DropDownList) _mygridview.FindControl("_action")); <--- returns NULL
        RegTool.setStatus(sSQL,_action,_network.SelectedValue.ToString()); <--fails databinding cause control is NULL
        _action.SelectedIndex = 0;
Join our community to see this answer!
Unlock 1 Answer and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros