I have a bound drop down list that I would like to place into a TableCell. I am used to Labels and TextBoxes but I cannot seem to get the syntax working on this one. This code is inside of a Webmethod and my output has to be just the html. Thank you.

public static string gatherSurchargeData(string PriceListItemID, string ProdID, string ColorCode)
DataTable GetProductSizes = new DataTable();

GetProductSizes = DataLayer.PricingToolDL.getProductSizes(ProdID, ColorCode);

DataTable dt = new DataTable();

dt = DataLayer.PricingToolDL.getScharge(PriceListItemID);

Table tblScharges = new Table();
tblScharges.ID = "tblScharges";

TableHeaderRow th = new TableHeaderRow();

TableHeaderCell thSizeScharge = new TableHeaderCell();

thSizeScharge.Text = "Size";



int i = 0;

    while (i <= dt.Rows.Count - 1)
        TableRow tr = new TableRow();
        tr.ID = "tableTr" + i;
        TableCell tcSizeScharge = new TableCell();

        DropDownList ddl = new DropDownList();

        ddl.DataSource = GetProductSizes;
        ddl.DataTextField = "FitSize";
        ddl.DataValueField = "FitSize";

        //string dtMovexSKU = dt.Rows[i]["MovexSKU"].ToString();
        //DataRow[] GetProductSizesMovexSKU = GetProductSizes.Select("MovexSKU Like'" + dtMovexSKU + "'");

        //tcSizeScharge.ID = "tcSizeScharge" + i;

        //tcSizeScharge.Text = GetProductSizesMovexSKU[0][1].ToString();



string html = "";
using (StringWriter sw = new StringWriter())
    tblScharges.RenderControl(new HtmlTextWriter(sw));
    html = sw.ToString();

return html;

The commented lines would be the code I would use if I were only wanting text to appear if that helps.

Related posts

Recent Viewed