Using Functions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suganya
    New Member
    • Dec 2006
    • 39

    Using Functions

    Hi

    I have given the If statement under the save button click event as

    Code:
    if (ThemeDropDownList.SelectedValue == "Blue")
    {
                empty.Attributes.Add("BgColor", "blue");
                Save.CssClass = "ButtonIE1";
                ClearButton.CssClass = "ButtonIE1";
                HtmlTableCell WebBody = (HtmlTableCell)Master.FindControl("row1");
                WebBody.Attributes.Add("BgColor", "blue");
    }
    else
    {
                empty.Attributes.Add("BgColor", "#518643");
                Save.CssClass = "ButtonIE";
                ClearButton.CssClass = "ButtonIE";
                HtmlTableCell WebBody = (HtmlTableCell)Master.FindControl("row1");
                WebBody.Attributes.Add("BgColor", "#518643");
    }

    If I put this into a function then what would be a return type. If the function I specified is correct

    Code:
    protected void InsertDoctorSettingDetails()
    {
     if (ThemeDropDownList.SelectedValue == "Blue")
            {
                empty.Attributes.Add("BgColor", "blue");
                Save.CssClass = "ButtonIE1";
                ClearButton.CssClass = "ButtonIE1";
                HtmlTableCell WebBody = (HtmlTableCell)Master.FindControl("row1");
                WebBody.Attributes.Add("BgColor", "blue");
                }
    else
            {
                empty.Attributes.Add("BgColor", "#518643");
                Save.CssClass = "ButtonIE";
                ClearButton.CssClass = "ButtonIE";
                HtmlTableCell WebBody = (HtmlTableCell)Master.FindControl("row1");
                WebBody.Attributes.Add("BgColor", "#518643");
               }
    }


    is this right
    Last edited by Curtis Rutland; Sep 30 '08, 01:50 PM. Reason: Added Code Tags - Please surround your code with [CODE] and [/CODE]
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    I'm not sure at all what you are asking.

    Please clarify.

    Also, please remember to use [CODE] tags when posting any code.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      According to your function, the return type is void (read that as nothing). Did you want the function to return something?

      Comment

      Working...