Header

Wednesday, 18 April 2012

SPGrid View Styling


If we want to put our own Styling in SPGrid View then we need to change Corev4.css, and it is not good :(

So what should we do ?

Simple just put internal style sheet, but again what should we need to change. Bcz when i had started, it was too
struglling for me. But u dont worry :)
For you i have solutions.

Suppose you need to change Heading color,Background of heading then use this.

TH .ms-vb A{
color:#4b4b4b !important;
}

above style is for the heading of SPGridView text.


.ms-listviewtable .ms-vh2{
padding:0px !important;
background:#cdcdcd;
}

above style is for the background of heading


TD Table.ms-listviewtable
{
border-collapse:separate !important;
}
TH .ms-vb
{
    padding-top:5px !important;
}
.ms-vh2 Table.ms-selectedtitle
{
    background:#cdcdcd !important;
}

above code is for background setting of heading

TR.ms-viewheadertr > TH.ms-vh2:hover
{
  background:#cdcdcd !important;
}
TR.ms-viewheadertr > TH.ms-vh:hover
{
  background:#cdcdcd !important;
}



above code is for background setting of heading Hover


I will update next part sooon

Tuesday, 27 March 2012

How to Populat a Drop-Down with List Data in Sharepoint


Some time we need to bind some column of SharePoint list to one Drop-Down.
When i had started working on SharePoint i used to bind Drop-Down with list through For Each loop, so it was time consuming and not good in programming.
Now i use simple and easy code without any loop.


       Dim ds As New DataSet()
        Dim mySite As SPSite = SPContext.Current.Site
        Dim myWeb As SPWeb = mySite.OpenWeb()
        Dim list As SPList = myWeb.Lists("ListName")
        Dim DTable_List As DataTable = list.Items.GetDataTable()
        DTable_List.TableName = "Table1"
        ds.Tables.Add(DTable_List)
        DropDownBGroup.DataSource = ds.Tables("Table1")
        DropDownBGroup.DataTextField = "FieldName"
        DropDownBGroup.DataValueField = "FieldName"
        DropDownBGroup.DataBind()
        DropDownBGroup.SelectedIndex = 0



I hope this will helpful for you,

Thanks and Regards

How to get attached file url in sharepoint

This post has moved to this link

http://unique2026.blogspot.in/2013/08/how-to-get-attached-file-url-in_7.html







Monday, 12 March 2012

Cookies Based Authentication

Monday, 20 February 2012

How to detect escape key press with javascript

This post has moved to this link

http://unique2026.blogspot.in/2013/08/how-to-detect-escape-key-press-with.html







How to upload image in Sharepoint Document

Hi Frnds,
Some time we need to upload one image for each pages in document library.
So i am uploading one -one image for each page and giving name for image is page name so it would be unique.
This is being stored in one document library.

  Dim spSite As SPSite = New SPSite("yoursite url")
            Dim _web As SPWeb = spSite.OpenWeb()
            Dim slist As SPList = _web.Lists("Content Images")
            Dim sPath As String = System.Web.HttpContext.Current.Request.Url.AbsolutePath
            Dim oInfo As System.IO.FileInfo = New System.IO.FileInfo(sPath)
            Dim sRet As String = HttpUtility.UrlDecode(oInfo.Name)
            Dim imageName As String = sRet.Substring(0, sRet.LastIndexOf("."))
            If FileUploadAttach.HasFile Then
                Dim fileExtension As String = FileUploadAttach.FileName.ToString.Substring(FileUploadAttach.FileName.ToString.LastIndexOf("."))

                imageName = imageName + fileExtension

                Dim destfile As SPFile = slist.RootFolder.Files.Add(slist.RootFolder.Url + "/" + imageName, FileUploadAttach.FileBytes, True)

                Dim item As SPListItem = destfile.Item
                item("Title") = FileUploadAttach.FileName.ToString
                item.Update()
            End If

Thanks and regards
Shailendra Kumar Singh

Sunday, 19 February 2012

How to call function inside Repeater

Hi frnds,
Some time we need to edit our items inside repeater. for this condition we can call a function that is being called at item bind inside repeater. This function will be called on every item.

Lets go for one example.
Suppose we are getting Customer name with their mail ID but our requirement is to display only Name .

abc@gmail.com, xyz@gmail.com, dums@gmail.com

These are the customer information but we need to display only
abc,  xyz, dums

so in this condition we can call a function that will give our need , but important point where we will call that
function
So here is the solution

<asp:Label runat="server" id="lblUser" text='<%# userName(Eval("EmailID"))%>' ></asp:Label>

here i am calling one function that's name is "userName()" and passing value EmailID .
This function will return wat we need

Thanks
Shailendra