cannot retrieve dropdownlist selected value

Discussion in 'ASP .Net' started by nLL, Jan 27, 2009.

  1. nLL

    nLL Guest

    Hi, i'm new to .net and having problem with a dropdown list.
    Basically i can not get selected index of extractedCss dropdown list on
    SaveTagButton_Click event. selected index always -1

    i have read couple of articles that says do not re-bind on post bask or
    do not put databind in page load event but none of my data binding is in
    page load event anyway.




    here is the code


    -------------------------
    using System;
    using System.Configuration;
    using System.Web.UI.WebControls;


    // tags etc
    //id,pageId,tagType,tagRelatedId,tagText,
    //tagStyleClass,tagFrontColor,tagFontDecoration,tagFontWeight,tagFontSize,tagBgColor,
    //tagBorderSize,tagBorderColor,tagHorizantalAlign,positionInPage


    public partial class manage_manageSiteEditPageAddNewItem :
    System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    Functions f = new Functions();

    if (f.LoginCheck() == true)
    {

    string connString =
    ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;

    int subdomainid =
    Functions.ReturnNumeric(Request["subdomainid"]);
    string subdomain = f.GetSubdomainNameById(subdomainid);
    int pageid = Functions.ReturnNumeric(Request["pageid"]);

    // get prviosu position. if 0 that means there are no
    previous elements
    int prevPositiontagid =
    Functions.ReturnNumeric(Request["prevPositiontagid"]);
    }
    else
    {
    //login wrong
    loggedinDiv.Visible = false;
    notLoggedInDiv.Visible = true;
    }

    }
    public void ExtractCSS(string subdomain)
    {
    // extract css from stlysheet
    myPageBuilder builder = new myPageBuilder();
    Panel_tagStyleClass.Visible = true;
    extractedCss.DataSource = builder.CssExtract(subdomain);
    extractedCss.DataTextField = "Cssclass";
    extractedCss.DataValueField = "Cssclass";
    extractedCss.DataBind();
    extractedCss.Items.Insert(0, new ListItem("Not configured", ""));
    }
    public void BuildFontColourList()
    {
    myPageBuilder builder = new myPageBuilder();
    FontColourList.DataSource = builder.colourList();
    FontColourList.DataValueField = "ColorHex";
    FontColourList.DataTextField = "ColorName";
    FontColourList.DataBind();
    FontColourList.Items.Insert(0, new ListItem("Not
    configured", ""));
    foreach (ListItem li in FontColourList.Items)
    {
    li.Attributes["style"] = "background-color: " +
    li.Value;
    }
    }
    public void BuildTagBgColorList()
    {
    myPageBuilder builder = new myPageBuilder();
    tagBgColorList.DataSource = builder.colourList();
    tagBgColorList.DataValueField = "ColorHex";
    tagBgColorList.DataTextField = "ColorName";
    tagBgColorList.DataBind();
    tagBgColorList.Items.Insert(0, new ListItem("Not configured", ""));
    foreach (ListItem lili in tagBgColorList.Items)
    {
    lili.Attributes["style"] = "background-color: " + lili.Value;
    }
    }
    public void BuildTagBorderColourList()
    {
    myPageBuilder builder = new myPageBuilder();
    tagBorderColourList.DataSource = builder.colourList();
    tagBorderColourList.DataValueField = "ColorHex";
    tagBorderColourList.DataTextField = "ColorName";
    tagBorderColourList.DataBind();
    tagBorderColourList.Items.Insert(0, new ListItem("Not
    configured", ""));
    foreach (ListItem lilil in tagBorderColourList.Items)
    {
    lilil.Attributes["style"] = "background-color: " + lilil.Value;
    }
    }
    protected void addTagButton_Click (object sender, EventArgs e)
    {

    Functions f = new Functions();
    myPageBuilder builder = new myPageBuilder();

    int subdomainid = Functions.ReturnNumeric(Request["subdomainid"]);
    string subdomain = f.GetSubdomainNameById(subdomainid);
    string selectedTag = tagList.SelectedValue.ToString();

    Panel panelToShow = (Panel)loggedinDiv.FindControl("Panel_" +
    selectedTag);// ("Panel_LineBreak");
    // show selected panel
    panelToShow.Visible = true;
    // show style options taxt
    styleOptionsLabel.Visible = true;
    manualStyleOptionsLabel.Visible = true;
    // extract style shee
    ExtractCSS(subdomain);
    // show save buttons
    SaveTagButtonPanel1.Visible = true;



    //tag spesific properties
    switch (selectedTag)
    {
    case "LineBreak":
    tagType.Value = "LineBreak";
    break;

    case "Text":
    tagType.Value = "Text";
    Panel_tagFontColor.Visible = true;
    Panel_tagFontDecoration.Visible = true;
    Panel_tagFontWeight.Visible = true;
    Panel_tagFontSize.Visible = true;
    Panel_tagBgColor.Visible = true;
    Panel_tagBorderSize.Visible = true;
    Panel_tagBorderColor.Visible = true;
    SaveTagButtonPanel2.Visible = true;
    BuildFontColourList();
    BuildTagBgColorList();
    BuildTagBorderColourList();
    break;

    case "TextLink":
    tagType.Value = "TextLink";
    Panel_tagFontColor.Visible = true;
    Panel_tagFontDecoration.Visible = true;
    Panel_tagFontWeight.Visible = true;
    Panel_tagFontSize.Visible = true;
    SaveTagButtonPanel2.Visible = true;
    BuildFontColourList();
    break;

    case "Image":
    tagType.Value = "Image";
    Panel_tagBorderSize.Visible = true;
    Panel_tagBorderColor.Visible = true;
    SaveTagButtonPanel2.Visible = true;
    BuildTagBorderColourList();
    break;

    case "ImageLink":
    tagType.Value = "ImageLink";
    Panel_tagBorderSize.Visible = true;
    Panel_tagBorderColor.Visible = true;
    SaveTagButtonPanel2.Visible = true;
    BuildTagBorderColourList();
    break;

    case "HtmlCode":
    tagType.Value = "HtmlCode";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "CodeSnippet":
    tagType.Value = "CodeSnippet";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "LinkRotator":
    tagType.Value = "LinkRotator";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "AdmobAdvert":
    tagType.Value = "AdmobAdvert";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "AdultmodaAdvert":
    tagType.Value = "HtmlCode";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "AdmodaAdvert":
    tagType.Value = "AdmodaAdvert";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "BuzzcityAdvert":
    tagType.Value = "BuzzcityAdvert";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "DecktradeAdvert":
    tagType.Value = "DecktradeAdvert";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "GoogleAdvert":
    tagType.Value = "GoogleAdvert";
    Panel_tagStyleClass.Visible = false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    case "MojivaAdvert":
    tagType.Value = "MojivaAdvert";
    Panel_tagStyleClass.Visible =false;
    styleOptionsLabel.Visible = false;
    manualStyleOptionsLabel.Visible = false;
    break;

    //default: other++; break;
    }

    }
    protected void SaveTagButton_Click (object sender, EventArgs e)
    {

    Functions f = new Functions();
    SaveButtonResultPanel.Visible = true;
    string TagTypeToSave =
    Functions.LimitString(tagType.Value.ToString(),20);
    TagTypeToSave = Server.HtmlEncode(TagTypeToSave);
    TagTypeToSave = f.SqlProtect(TagTypeToSave);

    //string CssClassToSave =
    Functions.LimitString(extractedCss.SelectedValue.ToString(),20);
    Response.Write(extractedCss.SelectedIndex.ToString());
    //string CssClassToSave;
    //CssClassToSave = Server.HtmlEncode(CssClassToSave);
    //CssClassToSave = f.SqlProtect(CssClassToSave);

    string FontSizeToSave =
    Functions.LimitString(fontSizeList.SelectedValue.ToString(),20);
    FontSizeToSave = Server.HtmlEncode(FontSizeToSave);
    FontSizeToSave = f.SqlProtect(FontSizeToSave);

    string FontColourToSave =
    Functions.LimitString(FontColourList.SelectedValue.ToString(),20);
    FontColourToSave = Server.HtmlEncode(FontColourToSave);
    FontColourToSave = f.SqlProtect(FontColourToSave);

    string FontDecorationToSave =
    Functions.LimitString(fontDecorationList.SelectedValue.ToString(),20);
    FontDecorationToSave = Server.HtmlEncode(FontDecorationToSave);
    FontDecorationToSave = f.SqlProtect(FontDecorationToSave);

    string FontWeightToSave =
    Functions.LimitString(fontWeightList.SelectedValue.ToString(),20);
    FontWeightToSave = Server.HtmlEncode(FontWeightToSave);
    FontWeightToSave = f.SqlProtect(FontWeightToSave);

    string TagBgColorToSave =
    Functions.LimitString(tagBgColorList.SelectedValue.ToString(),20);
    TagBgColorToSave = Server.HtmlEncode(TagBgColorToSave);
    TagBgColorToSave = f.SqlProtect(TagBgColorToSave);

    int TagtagBorderSizeToSave =
    Functions.ReturnNumeric(tagBorderSizeList.SelectedValue.ToString());

    string TagBorderColourToSave =
    Functions.LimitString(tagBorderColourList.SelectedValue.ToString(), 20);
    TagBorderColourToSave = Server.HtmlEncode(TagBorderColourToSave);
    TagBorderColourToSave = f.SqlProtect(TagBorderColourToSave);

    switch (TagTypeToSave)
    {
    case "Text":
    string TextToSave=
    Functions.LimitString(TextText.Text.ToString(),500);
    TextToSave = Server.HtmlEncode(TextToSave);
    TextToSave = f.SqlProtect(TextToSave);

    SaveButtonResultLabel.Text = TextToSave;// TextToSave;
    break;
    }

    }
    }
    nLL, Jan 27, 2009
    #1
    1. Advertising

  2. I see nothing wrong at first blush. It should return 0 instead of -1, but I
    have not tested the code.

    Try adding the following (the > line is yours) and see if it changes:

    > extractedCss.Items.Insert(0, new ListItem("Not configured", ""));

    extractedCss.SelectedIndex = 0;



    --
    Gregory A. Beamer
    MVP; MCP: +I, Se, SD, DBA

    Blog:
    http://feeds.feedburner.com/GregoryBeamer

    *************************************************
    | Think outside the box! |
    *************************************************
    "nLL" <> wrote in message
    news:saEfl.9576$2...
    > Hi, i'm new to .net and having problem with a dropdown list.
    > Basically i can not get selected index of extractedCss dropdown list on
    > SaveTagButton_Click event. selected index always -1
    >
    > i have read couple of articles that says do not re-bind on post bask or do
    > not put databind in page load event but none of my data binding is in page
    > load event anyway.
    >
    >
    >
    >
    > here is the code
    >
    >
    > -------------------------
    > using System;
    > using System.Configuration;
    > using System.Web.UI.WebControls;
    >
    >
    > // tags etc
    > //id,pageId,tagType,tagRelatedId,tagText,
    > //tagStyleClass,tagFrontColor,tagFontDecoration,tagFontWeight,tagFontSize,tagBgColor,
    > //tagBorderSize,tagBorderColor,tagHorizantalAlign,positionInPage
    >
    >
    > public partial class manage_manageSiteEditPageAddNewItem :
    > System.Web.UI.Page
    > {
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > Functions f = new Functions();
    >
    > if (f.LoginCheck() == true)
    > {
    >
    > string connString =
    > ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
    >
    > int subdomainid =
    > Functions.ReturnNumeric(Request["subdomainid"]);
    > string subdomain = f.GetSubdomainNameById(subdomainid);
    > int pageid = Functions.ReturnNumeric(Request["pageid"]);
    >
    > // get prviosu position. if 0 that means there are no
    > previous elements
    > int prevPositiontagid =
    > Functions.ReturnNumeric(Request["prevPositiontagid"]);
    > }
    > else
    > {
    > //login wrong
    > loggedinDiv.Visible = false;
    > notLoggedInDiv.Visible = true;
    > }
    >
    > }
    > public void ExtractCSS(string subdomain)
    > {
    > // extract css from stlysheet
    > myPageBuilder builder = new myPageBuilder();
    > Panel_tagStyleClass.Visible = true;
    > extractedCss.DataSource = builder.CssExtract(subdomain);
    > extractedCss.DataTextField = "Cssclass";
    > extractedCss.DataValueField = "Cssclass";
    > extractedCss.DataBind();
    > extractedCss.Items.Insert(0, new ListItem("Not configured", ""));
    > }
    > public void BuildFontColourList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > FontColourList.DataSource = builder.colourList();
    > FontColourList.DataValueField = "ColorHex";
    > FontColourList.DataTextField = "ColorName";
    > FontColourList.DataBind();
    > FontColourList.Items.Insert(0, new ListItem("Not
    > configured", ""));
    > foreach (ListItem li in FontColourList.Items)
    > {
    > li.Attributes["style"] = "background-color: " +
    > li.Value;
    > }
    > }
    > public void BuildTagBgColorList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > tagBgColorList.DataSource = builder.colourList();
    > tagBgColorList.DataValueField = "ColorHex";
    > tagBgColorList.DataTextField = "ColorName";
    > tagBgColorList.DataBind();
    > tagBgColorList.Items.Insert(0, new ListItem("Not configured",
    > ""));
    > foreach (ListItem lili in tagBgColorList.Items)
    > {
    > lili.Attributes["style"] = "background-color: " + lili.Value;
    > }
    > }
    > public void BuildTagBorderColourList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > tagBorderColourList.DataSource = builder.colourList();
    > tagBorderColourList.DataValueField = "ColorHex";
    > tagBorderColourList.DataTextField = "ColorName";
    > tagBorderColourList.DataBind();
    > tagBorderColourList.Items.Insert(0, new ListItem("Not configured",
    > ""));
    > foreach (ListItem lilil in tagBorderColourList.Items)
    > {
    > lilil.Attributes["style"] = "background-color: " +
    > lilil.Value;
    > }
    > }
    > protected void addTagButton_Click (object sender, EventArgs e)
    > {
    >
    > Functions f = new Functions();
    > myPageBuilder builder = new myPageBuilder();
    >
    > int subdomainid = Functions.ReturnNumeric(Request["subdomainid"]);
    > string subdomain = f.GetSubdomainNameById(subdomainid);
    > string selectedTag = tagList.SelectedValue.ToString();
    >
    > Panel panelToShow = (Panel)loggedinDiv.FindControl("Panel_" +
    > selectedTag);// ("Panel_LineBreak");
    > // show selected panel
    > panelToShow.Visible = true;
    > // show style options taxt
    > styleOptionsLabel.Visible = true;
    > manualStyleOptionsLabel.Visible = true;
    > // extract style shee
    > ExtractCSS(subdomain);
    > // show save buttons
    > SaveTagButtonPanel1.Visible = true;
    >
    >
    >
    > //tag spesific properties
    > switch (selectedTag)
    > {
    > case "LineBreak":
    > tagType.Value = "LineBreak";
    > break;
    >
    > case "Text":
    > tagType.Value = "Text";
    > Panel_tagFontColor.Visible = true;
    > Panel_tagFontDecoration.Visible = true;
    > Panel_tagFontWeight.Visible = true;
    > Panel_tagFontSize.Visible = true;
    > Panel_tagBgColor.Visible = true;
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildFontColourList();
    > BuildTagBgColorList();
    > BuildTagBorderColourList();
    > break;
    >
    > case "TextLink":
    > tagType.Value = "TextLink";
    > Panel_tagFontColor.Visible = true;
    > Panel_tagFontDecoration.Visible = true;
    > Panel_tagFontWeight.Visible = true;
    > Panel_tagFontSize.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildFontColourList();
    > break;
    >
    > case "Image":
    > tagType.Value = "Image";
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildTagBorderColourList();
    > break;
    >
    > case "ImageLink":
    > tagType.Value = "ImageLink";
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildTagBorderColourList();
    > break;
    >
    > case "HtmlCode":
    > tagType.Value = "HtmlCode";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "CodeSnippet":
    > tagType.Value = "CodeSnippet";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "LinkRotator":
    > tagType.Value = "LinkRotator";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdmobAdvert":
    > tagType.Value = "AdmobAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdultmodaAdvert":
    > tagType.Value = "HtmlCode";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdmodaAdvert":
    > tagType.Value = "AdmodaAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "BuzzcityAdvert":
    > tagType.Value = "BuzzcityAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "DecktradeAdvert":
    > tagType.Value = "DecktradeAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "GoogleAdvert":
    > tagType.Value = "GoogleAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "MojivaAdvert":
    > tagType.Value = "MojivaAdvert";
    > Panel_tagStyleClass.Visible =false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > //default: other++; break;
    > }
    >
    > }
    > protected void SaveTagButton_Click (object sender, EventArgs e)
    > {
    >
    > Functions f = new Functions();
    > SaveButtonResultPanel.Visible = true;
    > string TagTypeToSave =
    > Functions.LimitString(tagType.Value.ToString(),20);
    > TagTypeToSave = Server.HtmlEncode(TagTypeToSave);
    > TagTypeToSave = f.SqlProtect(TagTypeToSave);
    >
    > //string CssClassToSave =
    > Functions.LimitString(extractedCss.SelectedValue.ToString(),20);
    > Response.Write(extractedCss.SelectedIndex.ToString());
    > //string CssClassToSave;
    > //CssClassToSave = Server.HtmlEncode(CssClassToSave);
    > //CssClassToSave = f.SqlProtect(CssClassToSave);
    >
    > string FontSizeToSave =
    > Functions.LimitString(fontSizeList.SelectedValue.ToString(),20);
    > FontSizeToSave = Server.HtmlEncode(FontSizeToSave);
    > FontSizeToSave = f.SqlProtect(FontSizeToSave);
    >
    > string FontColourToSave =
    > Functions.LimitString(FontColourList.SelectedValue.ToString(),20);
    > FontColourToSave = Server.HtmlEncode(FontColourToSave);
    > FontColourToSave = f.SqlProtect(FontColourToSave);
    >
    > string FontDecorationToSave =
    > Functions.LimitString(fontDecorationList.SelectedValue.ToString(),20);
    > FontDecorationToSave = Server.HtmlEncode(FontDecorationToSave);
    > FontDecorationToSave = f.SqlProtect(FontDecorationToSave);
    >
    > string FontWeightToSave =
    > Functions.LimitString(fontWeightList.SelectedValue.ToString(),20);
    > FontWeightToSave = Server.HtmlEncode(FontWeightToSave);
    > FontWeightToSave = f.SqlProtect(FontWeightToSave);
    >
    > string TagBgColorToSave =
    > Functions.LimitString(tagBgColorList.SelectedValue.ToString(),20);
    > TagBgColorToSave = Server.HtmlEncode(TagBgColorToSave);
    > TagBgColorToSave = f.SqlProtect(TagBgColorToSave);
    >
    > int TagtagBorderSizeToSave =
    > Functions.ReturnNumeric(tagBorderSizeList.SelectedValue.ToString());
    >
    > string TagBorderColourToSave =
    > Functions.LimitString(tagBorderColourList.SelectedValue.ToString(), 20);
    > TagBorderColourToSave = Server.HtmlEncode(TagBorderColourToSave);
    > TagBorderColourToSave = f.SqlProtect(TagBorderColourToSave);
    >
    > switch (TagTypeToSave)
    > {
    > case "Text":
    > string TextToSave=
    > Functions.LimitString(TextText.Text.ToString(),500);
    > TextToSave = Server.HtmlEncode(TextToSave);
    > TextToSave = f.SqlProtect(TextToSave);
    >
    > SaveButtonResultLabel.Text = TextToSave;// TextToSave;
    > break;
    > }
    >
    > }
    > }
    Cowboy \(Gregory A. Beamer\), Jan 27, 2009
    #2
    1. Advertising

  3. It looks to me that the extractedCSS dropdown only gets populated when the
    event handler addTagButton_Click is executed. So here's what I believe
    (without seeing this page actually execute) is happening.

    1. Page loads. The extractedCSS dropdown is empty.
    2. User enters some info, clicks on the addTagButton.
    3. addTagButton_Click event handler executes, populating the extractedCSS
    dropdown.
    4. User selects a value from the extractedCSS dropdown.
    5. User clicks on SaveTagButton.
    6. SaveTagButton_Click event handler executes.

    At this point (while SaveTagButton_Click) is executing, that extendedCSS
    dropdown has no more items. That's why you're getting a -1 for the selected
    index. To verify that this is what's happening, all you have to do is add a
    watch on extractedCSS.Items.Count and add a breakpoint inside of your
    SaveTagButton_Click event handler. You should see that this count will
    probably be 0.

    --
    Bart X. Tubalinal
    www.deviantpoint.com

    "nLL" <> wrote in message
    news:saEfl.9576$2...
    > Hi, i'm new to .net and having problem with a dropdown list.
    > Basically i can not get selected index of extractedCss dropdown list on
    > SaveTagButton_Click event. selected index always -1
    >
    > i have read couple of articles that says do not re-bind on post bask or do
    > not put databind in page load event but none of my data binding is in page
    > load event anyway.
    >
    >
    >
    >
    > here is the code
    >
    >
    > -------------------------
    > using System;
    > using System.Configuration;
    > using System.Web.UI.WebControls;
    >
    >
    > // tags etc
    > //id,pageId,tagType,tagRelatedId,tagText,
    > //tagStyleClass,tagFrontColor,tagFontDecoration,tagFontWeight,tagFontSize,tagBgColor,
    > //tagBorderSize,tagBorderColor,tagHorizantalAlign,positionInPage
    >
    >
    > public partial class manage_manageSiteEditPageAddNewItem :
    > System.Web.UI.Page
    > {
    > protected void Page_Load(object sender, EventArgs e)
    > {
    > Functions f = new Functions();
    >
    > if (f.LoginCheck() == true)
    > {
    >
    > string connString =
    > ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
    >
    > int subdomainid =
    > Functions.ReturnNumeric(Request["subdomainid"]);
    > string subdomain = f.GetSubdomainNameById(subdomainid);
    > int pageid = Functions.ReturnNumeric(Request["pageid"]);
    >
    > // get prviosu position. if 0 that means there are no
    > previous elements
    > int prevPositiontagid =
    > Functions.ReturnNumeric(Request["prevPositiontagid"]);
    > }
    > else
    > {
    > //login wrong
    > loggedinDiv.Visible = false;
    > notLoggedInDiv.Visible = true;
    > }
    >
    > }
    > public void ExtractCSS(string subdomain)
    > {
    > // extract css from stlysheet
    > myPageBuilder builder = new myPageBuilder();
    > Panel_tagStyleClass.Visible = true;
    > extractedCss.DataSource = builder.CssExtract(subdomain);
    > extractedCss.DataTextField = "Cssclass";
    > extractedCss.DataValueField = "Cssclass";
    > extractedCss.DataBind();
    > extractedCss.Items.Insert(0, new ListItem("Not configured", ""));
    > }
    > public void BuildFontColourList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > FontColourList.DataSource = builder.colourList();
    > FontColourList.DataValueField = "ColorHex";
    > FontColourList.DataTextField = "ColorName";
    > FontColourList.DataBind();
    > FontColourList.Items.Insert(0, new ListItem("Not
    > configured", ""));
    > foreach (ListItem li in FontColourList.Items)
    > {
    > li.Attributes["style"] = "background-color: " +
    > li.Value;
    > }
    > }
    > public void BuildTagBgColorList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > tagBgColorList.DataSource = builder.colourList();
    > tagBgColorList.DataValueField = "ColorHex";
    > tagBgColorList.DataTextField = "ColorName";
    > tagBgColorList.DataBind();
    > tagBgColorList.Items.Insert(0, new ListItem("Not configured",
    > ""));
    > foreach (ListItem lili in tagBgColorList.Items)
    > {
    > lili.Attributes["style"] = "background-color: " + lili.Value;
    > }
    > }
    > public void BuildTagBorderColourList()
    > {
    > myPageBuilder builder = new myPageBuilder();
    > tagBorderColourList.DataSource = builder.colourList();
    > tagBorderColourList.DataValueField = "ColorHex";
    > tagBorderColourList.DataTextField = "ColorName";
    > tagBorderColourList.DataBind();
    > tagBorderColourList.Items.Insert(0, new ListItem("Not configured",
    > ""));
    > foreach (ListItem lilil in tagBorderColourList.Items)
    > {
    > lilil.Attributes["style"] = "background-color: " +
    > lilil.Value;
    > }
    > }
    > protected void addTagButton_Click (object sender, EventArgs e)
    > {
    >
    > Functions f = new Functions();
    > myPageBuilder builder = new myPageBuilder();
    >
    > int subdomainid = Functions.ReturnNumeric(Request["subdomainid"]);
    > string subdomain = f.GetSubdomainNameById(subdomainid);
    > string selectedTag = tagList.SelectedValue.ToString();
    >
    > Panel panelToShow = (Panel)loggedinDiv.FindControl("Panel_" +
    > selectedTag);// ("Panel_LineBreak");
    > // show selected panel
    > panelToShow.Visible = true;
    > // show style options taxt
    > styleOptionsLabel.Visible = true;
    > manualStyleOptionsLabel.Visible = true;
    > // extract style shee
    > ExtractCSS(subdomain);
    > // show save buttons
    > SaveTagButtonPanel1.Visible = true;
    >
    >
    >
    > //tag spesific properties
    > switch (selectedTag)
    > {
    > case "LineBreak":
    > tagType.Value = "LineBreak";
    > break;
    >
    > case "Text":
    > tagType.Value = "Text";
    > Panel_tagFontColor.Visible = true;
    > Panel_tagFontDecoration.Visible = true;
    > Panel_tagFontWeight.Visible = true;
    > Panel_tagFontSize.Visible = true;
    > Panel_tagBgColor.Visible = true;
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildFontColourList();
    > BuildTagBgColorList();
    > BuildTagBorderColourList();
    > break;
    >
    > case "TextLink":
    > tagType.Value = "TextLink";
    > Panel_tagFontColor.Visible = true;
    > Panel_tagFontDecoration.Visible = true;
    > Panel_tagFontWeight.Visible = true;
    > Panel_tagFontSize.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildFontColourList();
    > break;
    >
    > case "Image":
    > tagType.Value = "Image";
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildTagBorderColourList();
    > break;
    >
    > case "ImageLink":
    > tagType.Value = "ImageLink";
    > Panel_tagBorderSize.Visible = true;
    > Panel_tagBorderColor.Visible = true;
    > SaveTagButtonPanel2.Visible = true;
    > BuildTagBorderColourList();
    > break;
    >
    > case "HtmlCode":
    > tagType.Value = "HtmlCode";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "CodeSnippet":
    > tagType.Value = "CodeSnippet";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "LinkRotator":
    > tagType.Value = "LinkRotator";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdmobAdvert":
    > tagType.Value = "AdmobAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdultmodaAdvert":
    > tagType.Value = "HtmlCode";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "AdmodaAdvert":
    > tagType.Value = "AdmodaAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "BuzzcityAdvert":
    > tagType.Value = "BuzzcityAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "DecktradeAdvert":
    > tagType.Value = "DecktradeAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "GoogleAdvert":
    > tagType.Value = "GoogleAdvert";
    > Panel_tagStyleClass.Visible = false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > case "MojivaAdvert":
    > tagType.Value = "MojivaAdvert";
    > Panel_tagStyleClass.Visible =false;
    > styleOptionsLabel.Visible = false;
    > manualStyleOptionsLabel.Visible = false;
    > break;
    >
    > //default: other++; break;
    > }
    >
    > }
    > protected void SaveTagButton_Click (object sender, EventArgs e)
    > {
    >
    > Functions f = new Functions();
    > SaveButtonResultPanel.Visible = true;
    > string TagTypeToSave =
    > Functions.LimitString(tagType.Value.ToString(),20);
    > TagTypeToSave = Server.HtmlEncode(TagTypeToSave);
    > TagTypeToSave = f.SqlProtect(TagTypeToSave);
    >
    > //string CssClassToSave =
    > Functions.LimitString(extractedCss.SelectedValue.ToString(),20);
    > Response.Write(extractedCss.SelectedIndex.ToString());
    > //string CssClassToSave;
    > //CssClassToSave = Server.HtmlEncode(CssClassToSave);
    > //CssClassToSave = f.SqlProtect(CssClassToSave);
    >
    > string FontSizeToSave =
    > Functions.LimitString(fontSizeList.SelectedValue.ToString(),20);
    > FontSizeToSave = Server.HtmlEncode(FontSizeToSave);
    > FontSizeToSave = f.SqlProtect(FontSizeToSave);
    >
    > string FontColourToSave =
    > Functions.LimitString(FontColourList.SelectedValue.ToString(),20);
    > FontColourToSave = Server.HtmlEncode(FontColourToSave);
    > FontColourToSave = f.SqlProtect(FontColourToSave);
    >
    > string FontDecorationToSave =
    > Functions.LimitString(fontDecorationList.SelectedValue.ToString(),20);
    > FontDecorationToSave = Server.HtmlEncode(FontDecorationToSave);
    > FontDecorationToSave = f.SqlProtect(FontDecorationToSave);
    >
    > string FontWeightToSave =
    > Functions.LimitString(fontWeightList.SelectedValue.ToString(),20);
    > FontWeightToSave = Server.HtmlEncode(FontWeightToSave);
    > FontWeightToSave = f.SqlProtect(FontWeightToSave);
    >
    > string TagBgColorToSave =
    > Functions.LimitString(tagBgColorList.SelectedValue.ToString(),20);
    > TagBgColorToSave = Server.HtmlEncode(TagBgColorToSave);
    > TagBgColorToSave = f.SqlProtect(TagBgColorToSave);
    >
    > int TagtagBorderSizeToSave =
    > Functions.ReturnNumeric(tagBorderSizeList.SelectedValue.ToString());
    >
    > string TagBorderColourToSave =
    > Functions.LimitString(tagBorderColourList.SelectedValue.ToString(), 20);
    > TagBorderColourToSave = Server.HtmlEncode(TagBorderColourToSave);
    > TagBorderColourToSave = f.SqlProtect(TagBorderColourToSave);
    >
    > switch (TagTypeToSave)
    > {
    > case "Text":
    > string TextToSave=
    > Functions.LimitString(TextText.Text.ToString(),500);
    > TextToSave = Server.HtmlEncode(TextToSave);
    > TextToSave = f.SqlProtect(TextToSave);
    >
    > SaveButtonResultLabel.Text = TextToSave;// TextToSave;
    > break;
    > }
    >
    > }
    > }
    Bart Tubalinal, Jan 28, 2009
    #3
  4. Actually, disregard #4 & 5. Just validate that there are items in the
    extractedCSS dropdown when the SaveTagButton_Click event handler executes. I
    created a little test and the only way I was able to reproduce a
    SelectedIndex with a value of -1 was when there were no items at all in the
    drop down. If I had even 1 item in the drop down, it was automatically
    "selected" and the SelectedIndex was 0 even if I didn't explicitly select
    the item.

    --
    Bart X. Tubalinal
    www.deviantpoint.com

    "Bart Tubalinal" <> wrote in message
    news:...
    > It looks to me that the extractedCSS dropdown only gets populated when the
    > event handler addTagButton_Click is executed. So here's what I believe
    > (without seeing this page actually execute) is happening.
    >
    > 1. Page loads. The extractedCSS dropdown is empty.
    > 2. User enters some info, clicks on the addTagButton.
    > 3. addTagButton_Click event handler executes, populating the extractedCSS
    > dropdown.
    > 4. User selects a value from the extractedCSS dropdown.
    > 5. User clicks on SaveTagButton.
    > 6. SaveTagButton_Click event handler executes.
    >
    > At this point (while SaveTagButton_Click) is executing, that extendedCSS
    > dropdown has no more items. That's why you're getting a -1 for the
    > selected index. To verify that this is what's happening, all you have to
    > do is add a watch on extractedCSS.Items.Count and add a breakpoint inside
    > of your SaveTagButton_Click event handler. You should see that this count
    > will probably be 0.
    >
    > --
    > Bart X. Tubalinal
    > www.deviantpoint.com
    >
    > "nLL" <> wrote in message
    > news:saEfl.9576$2...
    >> Hi, i'm new to .net and having problem with a dropdown list.
    >> Basically i can not get selected index of extractedCss dropdown list on
    >> SaveTagButton_Click event. selected index always -1
    >>
    >> i have read couple of articles that says do not re-bind on post bask or
    >> do not put databind in page load event but none of my data binding is in
    >> page load event anyway.
    >>
    >>
    >>
    >>
    >> here is the code
    >>
    >>
    >> -------------------------
    >> using System;
    >> using System.Configuration;
    >> using System.Web.UI.WebControls;
    >>
    >>
    >> // tags etc
    >> //id,pageId,tagType,tagRelatedId,tagText,
    >> //tagStyleClass,tagFrontColor,tagFontDecoration,tagFontWeight,tagFontSize,tagBgColor,
    >> //tagBorderSize,tagBorderColor,tagHorizantalAlign,positionInPage
    >>
    >>
    >> public partial class manage_manageSiteEditPageAddNewItem :
    >> System.Web.UI.Page
    >> {
    >> protected void Page_Load(object sender, EventArgs e)
    >> {
    >> Functions f = new Functions();
    >>
    >> if (f.LoginCheck() == true)
    >> {
    >>
    >> string connString =
    >> ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
    >>
    >> int subdomainid =
    >> Functions.ReturnNumeric(Request["subdomainid"]);
    >> string subdomain = f.GetSubdomainNameById(subdomainid);
    >> int pageid = Functions.ReturnNumeric(Request["pageid"]);
    >>
    >> // get prviosu position. if 0 that means there are no
    >> previous elements
    >> int prevPositiontagid =
    >> Functions.ReturnNumeric(Request["prevPositiontagid"]);
    >> }
    >> else
    >> {
    >> //login wrong
    >> loggedinDiv.Visible = false;
    >> notLoggedInDiv.Visible = true;
    >> }
    >>
    >> }
    >> public void ExtractCSS(string subdomain)
    >> {
    >> // extract css from stlysheet
    >> myPageBuilder builder = new myPageBuilder();
    >> Panel_tagStyleClass.Visible = true;
    >> extractedCss.DataSource = builder.CssExtract(subdomain);
    >> extractedCss.DataTextField = "Cssclass";
    >> extractedCss.DataValueField = "Cssclass";
    >> extractedCss.DataBind();
    >> extractedCss.Items.Insert(0, new ListItem("Not configured", ""));
    >> }
    >> public void BuildFontColourList()
    >> {
    >> myPageBuilder builder = new myPageBuilder();
    >> FontColourList.DataSource = builder.colourList();
    >> FontColourList.DataValueField = "ColorHex";
    >> FontColourList.DataTextField = "ColorName";
    >> FontColourList.DataBind();
    >> FontColourList.Items.Insert(0, new ListItem("Not
    >> configured", ""));
    >> foreach (ListItem li in FontColourList.Items)
    >> {
    >> li.Attributes["style"] = "background-color: " +
    >> li.Value;
    >> }
    >> }
    >> public void BuildTagBgColorList()
    >> {
    >> myPageBuilder builder = new myPageBuilder();
    >> tagBgColorList.DataSource = builder.colourList();
    >> tagBgColorList.DataValueField = "ColorHex";
    >> tagBgColorList.DataTextField = "ColorName";
    >> tagBgColorList.DataBind();
    >> tagBgColorList.Items.Insert(0, new ListItem("Not configured",
    >> ""));
    >> foreach (ListItem lili in tagBgColorList.Items)
    >> {
    >> lili.Attributes["style"] = "background-color: " + lili.Value;
    >> }
    >> }
    >> public void BuildTagBorderColourList()
    >> {
    >> myPageBuilder builder = new myPageBuilder();
    >> tagBorderColourList.DataSource = builder.colourList();
    >> tagBorderColourList.DataValueField = "ColorHex";
    >> tagBorderColourList.DataTextField = "ColorName";
    >> tagBorderColourList.DataBind();
    >> tagBorderColourList.Items.Insert(0, new ListItem("Not
    >> configured", ""));
    >> foreach (ListItem lilil in tagBorderColourList.Items)
    >> {
    >> lilil.Attributes["style"] = "background-color: " +
    >> lilil.Value;
    >> }
    >> }
    >> protected void addTagButton_Click (object sender, EventArgs e)
    >> {
    >>
    >> Functions f = new Functions();
    >> myPageBuilder builder = new myPageBuilder();
    >>
    >> int subdomainid =
    >> Functions.ReturnNumeric(Request["subdomainid"]);
    >> string subdomain = f.GetSubdomainNameById(subdomainid);
    >> string selectedTag = tagList.SelectedValue.ToString();
    >>
    >> Panel panelToShow = (Panel)loggedinDiv.FindControl("Panel_" +
    >> selectedTag);// ("Panel_LineBreak");
    >> // show selected panel
    >> panelToShow.Visible = true;
    >> // show style options taxt
    >> styleOptionsLabel.Visible = true;
    >> manualStyleOptionsLabel.Visible = true;
    >> // extract style shee
    >> ExtractCSS(subdomain);
    >> // show save buttons
    >> SaveTagButtonPanel1.Visible = true;
    >>
    >>
    >>
    >> //tag spesific properties
    >> switch (selectedTag)
    >> {
    >> case "LineBreak":
    >> tagType.Value = "LineBreak";
    >> break;
    >>
    >> case "Text":
    >> tagType.Value = "Text";
    >> Panel_tagFontColor.Visible = true;
    >> Panel_tagFontDecoration.Visible = true;
    >> Panel_tagFontWeight.Visible = true;
    >> Panel_tagFontSize.Visible = true;
    >> Panel_tagBgColor.Visible = true;
    >> Panel_tagBorderSize.Visible = true;
    >> Panel_tagBorderColor.Visible = true;
    >> SaveTagButtonPanel2.Visible = true;
    >> BuildFontColourList();
    >> BuildTagBgColorList();
    >> BuildTagBorderColourList();
    >> break;
    >>
    >> case "TextLink":
    >> tagType.Value = "TextLink";
    >> Panel_tagFontColor.Visible = true;
    >> Panel_tagFontDecoration.Visible = true;
    >> Panel_tagFontWeight.Visible = true;
    >> Panel_tagFontSize.Visible = true;
    >> SaveTagButtonPanel2.Visible = true;
    >> BuildFontColourList();
    >> break;
    >>
    >> case "Image":
    >> tagType.Value = "Image";
    >> Panel_tagBorderSize.Visible = true;
    >> Panel_tagBorderColor.Visible = true;
    >> SaveTagButtonPanel2.Visible = true;
    >> BuildTagBorderColourList();
    >> break;
    >>
    >> case "ImageLink":
    >> tagType.Value = "ImageLink";
    >> Panel_tagBorderSize.Visible = true;
    >> Panel_tagBorderColor.Visible = true;
    >> SaveTagButtonPanel2.Visible = true;
    >> BuildTagBorderColourList();
    >> break;
    >>
    >> case "HtmlCode":
    >> tagType.Value = "HtmlCode";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "CodeSnippet":
    >> tagType.Value = "CodeSnippet";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "LinkRotator":
    >> tagType.Value = "LinkRotator";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "AdmobAdvert":
    >> tagType.Value = "AdmobAdvert";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "AdultmodaAdvert":
    >> tagType.Value = "HtmlCode";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "AdmodaAdvert":
    >> tagType.Value = "AdmodaAdvert";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "BuzzcityAdvert":
    >> tagType.Value = "BuzzcityAdvert";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "DecktradeAdvert":
    >> tagType.Value = "DecktradeAdvert";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "GoogleAdvert":
    >> tagType.Value = "GoogleAdvert";
    >> Panel_tagStyleClass.Visible = false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> case "MojivaAdvert":
    >> tagType.Value = "MojivaAdvert";
    >> Panel_tagStyleClass.Visible =false;
    >> styleOptionsLabel.Visible = false;
    >> manualStyleOptionsLabel.Visible = false;
    >> break;
    >>
    >> //default: other++; break;
    >> }
    >>
    >> }
    >> protected void SaveTagButton_Click (object sender, EventArgs e)
    >> {
    >>
    >> Functions f = new Functions();
    >> SaveButtonResultPanel.Visible = true;
    >> string TagTypeToSave =
    >> Functions.LimitString(tagType.Value.ToString(),20);
    >> TagTypeToSave = Server.HtmlEncode(TagTypeToSave);
    >> TagTypeToSave = f.SqlProtect(TagTypeToSave);
    >>
    >> //string CssClassToSave =
    >> Functions.LimitString(extractedCss.SelectedValue.ToString(),20);
    >> Response.Write(extractedCss.SelectedIndex.ToString());
    >> //string CssClassToSave;
    >> //CssClassToSave = Server.HtmlEncode(CssClassToSave);
    >> //CssClassToSave = f.SqlProtect(CssClassToSave);
    >>
    >> string FontSizeToSave =
    >> Functions.LimitString(fontSizeList.SelectedValue.ToString(),20);
    >> FontSizeToSave = Server.HtmlEncode(FontSizeToSave);
    >> FontSizeToSave = f.SqlProtect(FontSizeToSave);
    >>
    >> string FontColourToSave =
    >> Functions.LimitString(FontColourList.SelectedValue.ToString(),20);
    >> FontColourToSave = Server.HtmlEncode(FontColourToSave);
    >> FontColourToSave = f.SqlProtect(FontColourToSave);
    >>
    >> string FontDecorationToSave =
    >> Functions.LimitString(fontDecorationList.SelectedValue.ToString(),20);
    >> FontDecorationToSave = Server.HtmlEncode(FontDecorationToSave);
    >> FontDecorationToSave = f.SqlProtect(FontDecorationToSave);
    >>
    >> string FontWeightToSave =
    >> Functions.LimitString(fontWeightList.SelectedValue.ToString(),20);
    >> FontWeightToSave = Server.HtmlEncode(FontWeightToSave);
    >> FontWeightToSave = f.SqlProtect(FontWeightToSave);
    >>
    >> string TagBgColorToSave =
    >> Functions.LimitString(tagBgColorList.SelectedValue.ToString(),20);
    >> TagBgColorToSave = Server.HtmlEncode(TagBgColorToSave);
    >> TagBgColorToSave = f.SqlProtect(TagBgColorToSave);
    >>
    >> int TagtagBorderSizeToSave =
    >> Functions.ReturnNumeric(tagBorderSizeList.SelectedValue.ToString());
    >>
    >> string TagBorderColourToSave =
    >> Functions.LimitString(tagBorderColourList.SelectedValue.ToString(), 20);
    >> TagBorderColourToSave = Server.HtmlEncode(TagBorderColourToSave);
    >> TagBorderColourToSave = f.SqlProtect(TagBorderColourToSave);
    >>
    >> switch (TagTypeToSave)
    >> {
    >> case "Text":
    >> string TextToSave=
    >> Functions.LimitString(TextText.Text.ToString(),500);
    >> TextToSave = Server.HtmlEncode(TextToSave);
    >> TextToSave = f.SqlProtect(TextToSave);
    >>
    >> SaveButtonResultLabel.Text = TextToSave;// TextToSave;
    >> break;
    >> }
    >>
    >> }
    >> }

    >
    Bart Tubalinal, Jan 28, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tom Bray
    Replies:
    2
    Views:
    2,131
    JeffSchumacher
    Apr 13, 2005
  2. Iain
    Replies:
    3
    Views:
    928
  3. Nathan Sokalski
    Replies:
    0
    Views:
    608
    Nathan Sokalski
    Oct 5, 2008
  4. domchik
    Replies:
    1
    Views:
    222
    domchik
    Sep 4, 2003
  5. Nathan Sokalski

    Selected ListItem in DropDownList does not appear selected

    Nathan Sokalski, Oct 5, 2008, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    290
    Nathan Sokalski
    Oct 5, 2008
Loading...

Share This Page