"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Showing posts with label DropDownList. Show all posts
Showing posts with label DropDownList. Show all posts

Monday, February 11, 2013

Bind Dropdown on Footer templete


protected void grdRequestHandling_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.Footer)
                {
                    DropDownList dropdown = e.Row.FindControl("ddlAddRole") as DropDownList;

                    dropdown.DataSource = objBL.GetRoles();
                    dropdown.DataTextField = "RoleName";
                    dropdown.DataValueField = "RoleId";
                    dropdown.DataBind();
                }
            }
            catch (Exception)
            {
               
            }
        }


If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)

Monday, October 10, 2011

Conditionally enabling and disabling dropdown using jquery

Hi *.*,
2day i'm showing enable/disable dropdownlist through checkbox selection using Jquery 
Code

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>DEMO BY SIMPLYASP.BLOGSPOT.COM</title>
    <script src="Script/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chkbox").click(function () {
                if (this.checked)
                    $('#DrpList').attr('disabled', 'disabled');
                else
                    $('#DrpList').removeAttr('disabled');
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:CheckBox ID="chkbox" runat="server" Text="Enable/Disable" /><br />
        <asp:DropDownList ID="DrpList" runat="server">
            <asp:ListItem Text="Select" Value="-1"></asp:ListItem>
            <asp:ListItem Text="Option1" Value="1" />
            <asp:ListItem Text="Option2" Value="2" />
            <asp:ListItem Text="Option3" Value="3" />
        </asp:DropDownList>
    </div>
    </form>
</body>
</html>





If u had any trouble just ask, Happy to help u :)
Stay Tune... 
Have a nice day... 'N happy Coding :)

Tuesday, October 4, 2011

Change the font color based on the value in dropdownlist in asp.net c#

 Hi *.*,
2day i'm showing some css magic on dropdown list.
demo
 
How to Implement?

On html


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Change the font color based on the value in dropdownlist in asp.net c#</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <asp:DropDownList ID="ddpdown" runat="server" >
    </asp:DropDownList>
    </div>
    </form>
</body>
</html>
 

 On Server Side


   protected void Page_Load(object sender, EventArgs e)
    {
        for (int _i = 0; _i < 10; _i++)
        {
           
            if (_i <5)
            {
                ddpdown.Items.Add(_i.ToString()+" - Not Avilable");
                ddpdown.Items[_i].Attributes.CssStyle.Add("color", "red");
            }
            else
            {
                ddpdown.Items.Add(_i.ToString()+" - Avilable");
                ddpdown.Items[_i].Attributes.CssStyle.Add("color", "green");
            }
           
        }
    }
 
Hope u got it...
Stay Tune...
Have a nice day... 'N happy Coding :)