DropDownList in Footer

Don
Joined
5 Oct 2005
Posts
11,239
Location
Liverpool
Hey All,

I have this code which I'm trying to get to populate the dropdownlist in the footer of my grid view

Code:
 protected void SoftList_RowCreated(Object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ImageButton expand = e.Row.FindControl("expand") as ImageButton;
            expand.CommandArgument = e.Row.RowIndex.ToString();
        }

        else if (e.Row.RowType == DataControlRowType.Footer)
        {
            DataSet DropInfo = SQLQueries.AvailSoftware();

            DropDownList soft = (DropDownList)e.Row.FindControl("DropDownListSoft");

            soft.DataSource = DropInfo;
            soft.DataTextField = "SoftwareName";
            soft.DataValueField = "SoftwareName";
            soft.DataBind();
        }
    }

the sql statement is

Code:
    public static DataSet AvailSoftware()
    {
        string connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
        System.Data.SqlClient.SqlConnection sqlconnection = new System.Data.SqlClient.SqlConnection(connectionString);

        string queryString = "SELECT * FROM Software WHERE LicenceAvail = 3";
        System.Data.SqlClient.SqlDataAdapter ad = new System.Data.SqlClient.SqlDataAdapter(queryString, connectionString);

        DataSet ds = new DataSet();
        ad.Fill(ds, "software");
        return ds;
    }

its not populating the dropdownlist in the code, which is:

Code:
                    <FooterTemplate>
                        <asp:DropDownList ID="DropDownListSoft" runat="server" DataTextField="SoftwareName">
                        </asp:DropDownList>
                    </FooterTemplate>

Help would be VERY appriciated with this...

Stelly
 
Back
Top Bottom