Tuesday, September 3, 2013

Find checked radio button throug jQuery

$("#_chkbox").change(function () {
            var items = $(".childCheckBox").find("input");
            if ($('#_chkbox').is(':checked') == false) {
                for (i = 0; i < items.length; i++) {
                    if (items[i].type == "checkbox") {
                        items[i].checked = false;
                    }
                }
            }
            if ($('#_chkbox').is(':checked') == true) {
                for (i = 0; i < items.length; i++) {
                    if (items[i].type == "checkbox") {
                        items[i].checked = true;
                    }
                }
            }
        });

How to get search content sources in a sharepoint site

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim farmServices As SPServiceCollection = SPFarm.Local.Services
        For Each s As SPService In farmServices
            Dim x As SPServiceApplicationCollection = s.Applications
            For Each f As SPServiceApplication In x
                If f.TypeName = "Search Service Application" Then
                    If f.DisplayName = "FAST Content SSA 14012013" Then
                        Dim ssa As SearchServiceApplication = CType(f, SearchServiceApplication)
                        Dim consources As List(Of String) = ssa.GetContentSourceNames()
                        For i As Integer = 0 To consources.Count - 1
                            Label1.Text &= consources(i) + "</br>"
                        Next
                    End If
                End If

            Next

        Next
    End Sub

How to get Site, Web, and List name from a list url

Some time we have url of list and need to find its web, list name ...

Basically what we do simply split string and get web name and list.
This approach will not give us dynamic solution.
We have SharPoint to do this in easy way and also dynamic... :)

 Using siteCollection As New SPSite(listurlfromitems)
            Dim Site As SPSite = siteCollection
            Dim myWeb As SPWeb = siteCollection.OpenWeb()
            Dim _list As SPList = myWeb.GetList(listurlfromitems)
End Using

Here listurlfromitems is a string which holds URL of list
after that we can find site, web, and list in Site, myWeb, _list variable...

Get Data of current login user in Sharpoint

some time we need to get data according to current user.
Like items that has been created by current login user.

And there so many approach to do this but what i will recommend that never goes wrong.

  osb.Append("     <Where>")
  osb.Append("                       <Eq>")
   osb.Append("                            <FieldRef Name=""Author"" LookupId=""True"" />")
    osb.Append("                            <Value Type=""Lookup""   >" & SPContext.Current.Web.CurrentUser.ID & "</Value>")
    osb.Append("                        </Eq>")
    osb.Append("         </Where>")


Just add this query and get what you wanted :D