Saturday 2 November 2013

Dropdown List with multiple selection option[SharePoint 2010]

Introduction


This Dropdown list with multiple Selection options. This Custom control dropdown of multiple Selection .in asp.net dropdown we select only one option at one time.



Dropdown with multiple selections Screen Shot





Aspx code:

<styletype="text/css">
.DivClose
    {
display: none;
position: absolute;
width: 150px;
height: 220px;
border-style: solid;
border-color: Gray;
border-width: 1px;
background-color: #F0FFFF;
    }

.LabelClose
    {
vertical-align: text-top;
position: absolute;
bottom: 0px;
font-family: Verdana;
    }

.DivCheckBoxList
    {
display: none;
background-color: White;
width: 150px;
position: absolute;
height: 200px;
overflow-y: auto;
overflow-x: hidden;
border-style: solid;
border-color: Gray;
border-width: 1px;
width: 150px;
    }

.CheckBoxList
    {
position: relative;
width: 150px;
height: 10px;
overflow: scroll;
font-size: small;
    }
.Maintitle
    {
text-align: left;
margin: 0em;
color: #00008B;
font-size: large;
padding-bottom: 16px;
border-bottom: 2pxsolid#A9A9A9;
margin-bottom: 10px;
white-space: nowrap;
    }
.headers
    {
text-align: left;
padding-right: 10px;
    }

.numbers
    {
text-align: right;
padding-right: 12px;
    }
.textData
    {
text-align: left;
padding-right: 10px;
    }
.numbersHeader
    {
width: 80px;
    }
.numbersfooter
    {
background-color: #d2d0d0;
color: #000000;
    }

.SGridView
    {
width: 100%;
    }
.style1
    {
height: 30px;
    }
</style>
<asp:LiteralID="LtrMessage"runat="server"></asp:Literal>

<tablestyle="padding-top: 9px">
<tr>

<tdstyle="padding-bottom: 13px; font-style: normal;">
<strong>City :</strong><spanstyle="color: Red; padding-left: 2px;">*</span>
</td>
<td>
<divid="divCustomCheckBoxList"runat="server"onmouseover="clearTimeout(timoutID);"
onmouseout="timoutID = setTimeout('HideMList()', 750);">
<table>
<tr>
<tdalign="right"class="style1">
<inputid="txtSelectedMLValues"type="text"readonly="readonly"onclick="ShowMList()"
style="width: 150px;"runat="server"/>
</td>
<tdalign="left"class="style1">
<imgid="imgShowHide"runat="server"align="left"onclick="ShowMList()"src="~/_layouts/1033/images/down-arrow.bmp"/>
</td>
</tr>
<tr>
<tdcolspan="2"class="DropDownLook">
<div>
<divrunat="server"id="divCheckBoxListClose"class="DivClose">
<labelrunat="server"onclick="HideMList();"class="LabelClose"id="lblClose">
<b>x</b>
</label>
</div>
<divrunat="server"title="divCheckBoxList"id="divCheckBoxList"class="DivCheckBoxList">
<asp:UpdatePanelID="UpdatePanel11"runat="server">
<ContentTemplate>
<asp:CheckBoxID="CheckBoxList1"runat="server"Text="All"AutoPostBack="true"OnCheckedChanged="CheckBoxList1_CheckedChanged">
</asp:CheckBox>
<asp:CheckBoxListID="lstMultipleValues"runat="server"Width="250px"CssClass="CheckBoxList">
</asp:CheckBoxList>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</td>
<td>
</td>
</tr>
</table>



<br/>
<br/>
<div>

</div>
<div>
<scripttype="text/javascript">

vartimoutID;

//This function shows the checkboxlist
functionShowMList() {

vardivRef = document.getElementById("<%=divCheckBoxList.ClientID%>");
divRef.style.display = "block";
vardivRefC = document.getElementById("<%=divCheckBoxListClose.ClientID%>");
divRefC.style.display = "block";

        }

//This function hides the checkboxlist
functionHideMList() {
document.getElementById("<%=divCheckBoxList.ClientID%>").style.display = "none";
document.getElementById("<%=divCheckBoxListClose.ClientID%>").style.display = "none";
        }


varcblstTable;
varcheckBoxPrefix;
varnoOfOptions;
varselectedText
functionFindSelectedItems(sender, textBoxID) {

cblstTable = document.getElementById(sender.id);
varflagUnchecked = 0;
varflaChecked = 0;
checkBoxPrefix = sender.id + "_";
noOfOptions = cblstTable.rows.length;
selectedText = "";
for (i = 0; i <noOfOptions; ++i) {
if (document.getElementById(checkBoxPrefix + i).checked) {
flag = 1;

if (selectedText == "")
selectedText = document.getElementById
                                   (checkBoxPrefix + i).parentNode.innerText;
else
selectedText = selectedText + "," +
document.getElementById(checkBoxPrefix + i).parentNode.innerText;
                }
            }
for (i = 0; i <noOfOptions; ++i) {
if (document.getElementById(checkBoxPrefix + i).checked == false) {
document.getElementById("<%=CheckBoxList1.ClientID%>").checked = false;

                }
if (document.getElementById(checkBoxPrefix + i).checked == true) {

flagUnchecked = 1;
flaChecked = flaChecked + 1;
                }

            }
document.getElementById(textBoxID.id).value = selectedText;
if (flagUnchecked == 0) {
document.getElementById(textBoxID.id).value = "Select City";
            }
if (flaChecked == noOfOptions) {
document.getElementById("<%=CheckBoxList1.ClientID%>").checked = true;
document.getElementById(textBoxID.id).value = "All City";
            }

        }

functionFindAllRepMgr(sender, textBoxID) {

if (document.getElementById("<%=CheckBoxList1.ClientID%>").checked == true) {
for (i = 0; i <noOfOptions; ++i) {
var raw = document.getElementById(checkBoxPrefix + i).rawValue = null;
var raw1 = document.getElementById(checkBoxPrefix + i).checked = true;
document.getElementById(checkBoxPrefix + i).checked == true;
                }
document.getElementById(textBoxID.id).value = "All City";
            }
if (document.getElementById("<%=CheckBoxList1.ClientID%>").checked == false) {
for (i = 0; i <noOfOptions; ++i) {
var raw = document.getElementById(checkBoxPrefix + i).rawValue = null;
var raw1 = document.getElementById(checkBoxPrefix + i).checked = false;
document.getElementById(checkBoxPrefix + i).checked == false;
                }
document.getElementById(textBoxID.id).value = "Select City";

            }
        }

</script>

</div>

C# :Cs.code




Summary
In this Article we  Explore  multiple Selection options and all give all selection option also.create multiple Selection options drop in SharePoint 2010

Wednesday 30 October 2013

SharePoint 2010: format date value in Data View Web Part – xslt

There are different ways to format date value in Sharepoint Data View Web Part using xslt.
To be able to use the FormatDate function, add the DDWRT name space reference in the top section.


In sharepoint Designer Xpath Method Add  FormatDate(Columnname,LCID,FormatFlat)method 


<xsl:value-of select="ddwrt:FormatDate(string(@StartDate), [LCID],[FORMAT FLAG])"/>


Format Flag

Format Flag
Example
1
MM/dd/yyyy. ==> “08/17/2000″
3
dddd, MM dd, yyyy. ==> “Thursday, August 17, 2000″
4
h:mm. ==> “16:32″
5
MM/dd/yyyy h:mm. ==> “08/17/2000 16:32″
7
dddd, MM dd, yyyy h:mm. ==> “Thursday, August 17, 2000 16:32″
12
h:mm:ss. ==> “16:32:32″
13
MM/dd/yyyy h:mm:ss. ==> “08/17/2000 16:32:32″
15
dddd, MMMM dd, yyyy h:mm:ss. ==> “Thursday, August 17, 2000 16:32:32”

LCID is a language code:
Language
LCID
Afrikaans
1078 (&H436)
Albanian
1052 (&H41C)
Arabic
1025 (&H401)
Arabic Algeria
5121 (&H1401)
Arabic Bahrain
15361 (&H3C01)
Arabic Egypt
3073 (&HC01)
Arabic Iraq
2049 (&H801)
Arabic Jordan
11265 (&H2C01)
Arabic Kuwait
13313 (&H3401)
Arabic Lebanon
12289 (&H3001)
Arabic Libya
4097 (&H1001)
Arabic Morocco
6145 (&H1801)
Arabic Oman
8193 (&H2001)
Arabic Qatar
16385 (&H4001)
Arabic Saudi Arabia
1025 (&H401)
Arabic Syria
10241 (&H2801)
Arabic Tunisia
7169 (&H1C01)
Arabic U.A.E
14337 (&H3801
Arabic Yemen
9217 (&H2401)
Armenian
1067 (&H42B)
Assamese
1101 (&H44D)
Azeri Cyrillic
2092 (&H82C)
Azeri Latin
1068 (&H42C)
Basque
1069 (&H42D)
Belgian Dutch
2067 (&H813)
Belgian French
2060 (&H80C)
Bengali
1093 (&H445)
Portuguese (Brazil)
1046 (&H416)
Bulgarian
1026 (&H402)
Burmese
1109 (&H455)
Byelorussian (Belarusian)
1059 (&H423)
Catalan
1027 (&H403)
Chinese Hong Kong SAR
3076 (&HC04)
Chinese Macau SAR
5124 (&H1404)
Chinese Simplified
2052 (&H804)
Chinese Singapore
4100 (&H1004)
Chinese Traditional
1028 (&H404)
Croatian
1050 (&H41A)
Czech
1029 (&H405)
Danish
1030 (&H406)
Dutch
1043 (&H413)
English Australia
3081 (&HC09)
English Belize
10249 (&H2809)
English Canadian
4105 (&H1009)
English Caribbean
9225 (&H2409)
English Ireland
6153 (&H1809)
English Jamaica
8201 (&H2009)
English New Zealand
5129 (&H1409)
English Philippines
13321 (&H3409)
English South Africa
7177 (&H1C09)
English Trinidad
11273 (&H2C09)
English U.K.
2057 (&H809)
English U.S.
1033 (&H409)
English Zimbabwe
12297 (&H3009)
Estonian
1061 (&H425)
Faeroese
1080 (&H438)
Farsi
1065 (&H429)
Finnish
1035 (&H40B)
French
1036 (&H40C)
French Cameroon
11276 (&H2C0C)
French Canadian
3084 (&HC0C)
French Cote d'Ivoire
12300 (&H300C)
French Luxembourg
5132 (&H140C)
French Mali
13324 (&H340C)
French Monaco
6156 (&H180C)
French Reunion
8204 (&H200C)
French Senegal
10252 (&H280C)
French West Indies
7180 (&H1C0C)
French Congo (DRC)
9228 (&H240C)
Frisian Netherlands
1122 (&H462)
Gaelic Ireland
2108 (&H83C)
Gaelic Scotland
1084 (&H43C)
Galician
1110 (&H456)
Georgian
1079 (&H437)
German
1031 (&H407)
German Austria
3079 (&HC07)
German Liechtenstein
5127 (&H1407)
German Luxembourg
4103 (&H1007)
Greek
1032 (&H408)
Gujarati
1095 (&H447)
Hebrew
1037 (&H40D)
Hindi
1081 (&H439)
Hungarian
1038 (&H40E)
Icelandic
1039 (&H40F)
Indonesian
1057 (&H421)
Italian
1040 (&H410)
Japanese
1041 (&H411)
Kannada
1099 (&H44B)
Kashmiri
1120 (&H460)
Kazakh
1087 (&H43F)
Khmer
1107 (&H453)
Kirghiz
1088 (&H440)
Konkani
1111 (&H457)
Korean
1042 (&H412)
Lao
1108 (&H454)
Latvian
1062 (&H426)
Lithuanian
1063 (&H427)
FYRO Macedonian
1071 (&H42F)
Malayalam
1100 (&H44C)
Malay Brunei Darussalam
2110 (&H83E)
Malaysian
1086 (&H43E)
Maltese
1082 (&H43A)
Manipuri
1112 (&H458)
Marathi
1102 (&H44E)
Mongolian
1104 (&H450)
Nepali
1121 (&H461)
Norwegian Bokmol
1044 (&H414)
Norwegian Nynorsk
2068 (&H814)
Oriya
1096 (&H448)
Polish
1045 (&H415)
Portuguese
2070 (&H816)
Punjabi
1094 (&H446)
Rhaeto-Romanic
1047 (&H417)
Romanian
1048 (&H418)
Romanian Moldova
2072 (&H818)
Russian
1049 (&H419)
Russian Moldova
2073 (&H819)
Sami Lappish
1083 (&H43B)
Sanskrit
1103 (&H44F)
Serbian Cyrillic
3098 (&HC1A)
Serbian Latin
2074 (&H81A)
Sesotho
1072 (&H430)
Sindhi
1113 (&H459)
Slovak
1051 (&H41B)
Slovenian
1060 (&H424)
Sorbian
1070 (&H42E)
Spanish (Traditional)
1034 (&H40A)
Spanish Argentina
11274 (&H2C0A)
Spanish Bolivia
16394 (&H400A)
Spanish Chile
13322 (&H340A)
Spanish Colombia
9226 (&H240A)
Spanish Costa Rica
5130 (&H140A)
Spanish Dominican Republic
7178 (&H1C0A)
Spanish Ecuador
12298 (&H300A)
Spanish El Salvador
17418 (&H440A)
Spanish Guatemala
4106 (&H100A)
Spanish Honduras
18442 (&H480A)
Spanish Nicaragua
19466 (&H4C0A)
Spanish Panama
6154 (&H180A)
Spanish Paraguay
15370 (H3C0A)
Spanish Peru
10250 (&H280A)
Spanish Puerto Rico
20490 (&H500A)
Spanish Spain (Modern Sort)
3082 (&HC0A)
Spanish Uruguay
14346 (&H380A)
Spanish Venezuela
8202 (&H200A)
Sutu
1072 (&H430)
Swahili
1089 (&H441)
Swedish
1053 (&H41D)
Swedish Finland
2077 (&H81D)
Swiss French
4108 (&H100C)
Swiss German
2055 (&H807)
Swiss Italian
2064 (&H810)
Tajik
1064 (&H428)
Tamil
1097 (&H449)
Tatar
1092 (&H444)
Telugu
1098 (&H44A)
Thai
1054 (&H41E)
Tibetan
1105 (&H451)
Tsonga
1073 (&H431)
Tswana
1074 (&H432)
Turkish
1055 (&H41F)
Turkmen
1090 (&H442)
Ukrainian
1058 (&H422)
Urdu
1056 (&H420)
Uzbek Cyrillic
2115 (&H843)
Uzbek Latin
1091 (&H443)
Venda
1075 (&H433)
Vietnamese
1066 (&H42A)
Welsh
1106 (&H452)
Xhosa
1076 (&H434)
Zulu
1077 (&H435)

SharePoint 2013 - Uploading Multiple Attachments To The New Item On List Using JSOM And REST API

  Introduction In this article, we will explore how we can attach multiple attachments to the new item on list using JSOM and REST API. Ther...