Wednesday, September 12, 2012

Kerberos--

Guys.. I m preparing small documetation regarding the Kerberos in Sharepoint and the double hop issues.
Meantime, if you guys have any related issues with Sharepoint Kervberos, feel free to post questions.

We got one while trying to connect to OLAP via custom webpart where we were not able to connect to OLAP cube. Finally we nailed it down and saw another beauty of Kerberos.

Roshan

Tuesday, March 6, 2012

LINQ to SQL not updating the record in the table

Hi,

I was using LINQ to SQL (first time to be honest) and i was excited. So one of my task was to update db table for which i used the following code.

MPSCGetDataFromDBDataContext dc = new MPSCGetDataFromDBDataContext();
MPSC_WFStatus wfStatus = dc.MPSC_WFStatus.Single(p => p.WFID == item.WFID);
wfStatus.IsNew = 1;
dc.SubmitChanges();

But it was not updating the data table. So after hitting my head on wall for a while, finally i broke it and found the silly mistake that i made:
---- Define Primary key on dbml.

aha... what a relief.. its updating the tables. Just posting incase any of you are in the same situation.

-Cheers!

Thursday, October 27, 2011

Accessing Sharepoint DateTimeControl in Javascript

Hi Guys,

I thought it worth posting this on how to access the sharepoint DatetimeControl in case if you are creating custom webparts with this controls or writing some custom javascripts.

in javascript:


function GetDate()
{
var sdate=document.getElementbyId('<%=dateControlName.Controls[0].ClientID %>');
alert (sdate.value);
}

Cheers!

Thursday, September 23, 2010

Getting List Internal Name

Hi Guys,
I ran into a very wierd but intresting issue today. The client changed the document library name and suddenly even handler started throwing error saying the file path does not matched. Whenever the list name changes, the internal name remains same and the path of the file remains with the internal name. So my properties.ListTitle was picking the display name and could not find the file.

So always better approach is to use list internal name.
Not simple but not even complex:
I used

properties.ListItem.ListItems.List.RootFolder.Name

and it gave me the list internal name and the issue was fixed. Cheers!

So, the basic logic is that, if you want to use list internal name, then you have to follow

objList.RootFolder.Name

Tuesday, September 14, 2010

Twitter Friends Timeline and oAuth

Hi Guys,

If you guys had done any task regarding Twitter feed webpart, you should know by now that your webpart is not working anymore. The reason being the authentication of twitter has been changed from basic authentication ot oAuth.

currently i am working on my enhancement on twitter webpart to sync the authntication with oAuth. Let me know if you guys need a code snapshots.

Thanks

Monday, August 2, 2010

Gridview to Excel.

Senerio: A gridview hold a data and on a button click we are sending it to Excel letting user to open or save the file. I used this in one of our Sharepoint Webpart.

Assumption: Paging and sorting are enabled. gv is a asp gridview .

protected override void OnPreRender(EventArgs e)
{
gv.AllowPaging = false;
gv.AllowSorting = false;
gv.DataBind();


HttpContext.Current.Response.Clear();
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel";
HttpContext.Current.Response.Charset = "";
this.EnableViewState = false;
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);
HtmlForm frm = new HtmlForm();
this.Controls.Add(frm);
frm.Controls.Add(gv);
frm.RenderControl(oHtmlTextWriter);
HttpContext.Current.Response.Write(oStringWriter.ToString());
HttpContext.Current.Response.End();

gv.AllowPaging = true;
gv.AllowSorting = true;
gv.DataBind();

}


Hope it helps and Thank you for Visiting!

Thursday, July 22, 2010

Next to Follow:

Next :
  • Sharepoint Twitter Webpart.
  • Rotating News Banner Webpart