Archive

Archive for December, 2015

Add ToolTip for DropDownList Items in ASP.Net

December 30, 2015 Leave a comment

Hi all,

Try this example to Add ToolTip for DropDownList Items in ASP.Net

<asp:DropDownList ID="DropDownList1" runat="server" ondatabound="DropDownList1_DataBound">
</asp:DropDownList>

In Code behind :

protected void DropDownList1_DataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
if (ddl != null)
{
foreach (ListItem li in ddl.Items)
{
li.Attributes["title"] = li.Text; // setting text value of item as tooltip
}
}
}

Hope this helps

Good Luck

Advertisements
Categories: ASP.Net, Uncategorized

How to Upload a SharePoint List Template

December 17, 2015 Leave a comment

Hi all,

Follow this steps to Upload List Template in SharePoint 2010

– Go to the Home of your site

– Click on Site Actions and select Site Settings

– Under Galleries select List Templates

– Click the Documents tab and select Upload Document

– Select the list template (.stp file) that you want to upload

– Now you can create a list based on your new template

Good Luck

 

JQuery to get ASP.Net DropDownList Selected item Value, Text and Index

December 14, 2015 Leave a comment

Hi all,

Try this example to use JQuery to get ASP.Net DropDownList Selected item Value, Text and Index

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Example to get DropDownList selected item index, value and text</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#<%=ddlWeekDays.ClientID %>').on("change", function () {
                //Get DropDownlist selected item index
                var selectedIndex = $(this).find("option:selected").index();
                //Get DropDownlist selected item value
                var selectedValue = $(this).find("option:selected").val();
                //Get DropDownlist selected item text
                var selectedText = $(this).find("option:selected").text();
                $("#spnIndex").text(selectedIndex);
                $("#spnValue").text(selectedValue);
                $("#spnText").text(selectedText);
            });
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <fieldset style="width: 380px; height: 150px;">
                <legend>Get DropDownList Selected item Index, Value and Text</legend>
                <table>
                    <tr>
                        <td>Select Day:
                    <asp:DropDownList ID="ddlWeekDays" runat="server">
                        <asp:ListItem Value="0" Text="Select"></asp:ListItem>
                        <asp:ListItem Value="1" Text="Monday"></asp:ListItem>
                        <asp:ListItem Value="2" Text="Tuesday"></asp:ListItem>
                        <asp:ListItem Value="3" Text="Wednesday"></asp:ListItem>
                        <asp:ListItem Value="4" Text="Thursday"></asp:ListItem>
                        <asp:ListItem Value="5" Text="Friday"></asp:ListItem>
                        <asp:ListItem Value="6" Text="Saturday"></asp:ListItem>
                        <asp:ListItem Value="7" Text="Sunday"></asp:ListItem>
                    </asp:DropDownList>
                        </td>
                        <td>Selected Index :
                        </td>
                        <td>
                            <span id="spnIndex"></span>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>Selected Value :
                        </td>
                        <td>
                            <span id="spnValue"></span>
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>Selected Text :
                        </td>
                        <td>
                            <span id="spnText"></span>
                        </td>
                    </tr>
                </table>
            </fieldset>
        </div>
    </form>
</body>
</html>

Hope this helps

Good Luck.

Categories: Uncategorized