Browsing Month February, 2006

DataView Web Part Namespace

February 20th, 2006 // 5:22 pm @

I came acorss a nice link while browsing the newsgroups today. Serge van den Oever has posted on his blog, a nice analysis of the DataView Web Part and the namespaces available inside the dll’s. Look up this fantastic piece of analysis here.


Posted at DotNetJunkies on Monday, January 03, 2005 6:52 AM

Category : SharePoint

FAT32 and SharePoint Sites

February 20th, 2006 // 5:20 pm @

This is old stuff, but I guess will be valuable to new SharePoint developers.


Sometimes when you try to extend or create a portal on an IIS website, it does not appear in the list in SharePoint Central Admin. This occurs only when the target directory mapped in IIS for that website, is on a non NTFS file system. Move it to an NTFS drive, and voila, the site will appear in the list.


Posted at DotNetJunkies on Thursday, December 16, 2004 8:45 AM

Category : SharePoint

Using the SharePoint API

February 20th, 2006 // 5:18 pm @

One of my articles on using the SharePoint API to create Areas programatically, has been published on DevX. Am a bit late in sending the link, but for those interested, check it out at http://www.devx.com/dotnet/Article/22387.


Posted at DotNetJunkies on Tuesday, November 23, 2004 6:33 AM

Category : SharePoint

Solution to ASP.NET, Javascript value modification problem

February 20th, 2006 // 4:14 pm @

Sorry for being late. Was tied up in work. So lets start where I left off before. The main problem which I found was that if the ASP.NET button was clicked, and I wanted to run some client side Javascript to update the values of hidden form elements and get the updated values on the postback event handler for that same button, it ignored all the changes javascript made and did not reflect to the code behind. My target was to somehow reflect the changes to the values to the back end.


The solution was not a very elegant one, and I am sure there has to be a different solution to this. But at least it works and gets the job done.


What I did was that I changed by ASP Button in page B to a LinkButton. I assigned blank text to it so effectively making a hidden link button.


<A href=”javascript:SendMail();”>Send Mail</A>
<asp:linkbutton id=SendMail runat=”server”></asp:linkbutton>


This enabled me to call a Javascript when the button was clicked, and also allowed me to have a code behind event handler for the link button click. As the link button is effectively hidden and hence cannot generate an event for the link button click on the back end, we have to raise this event manually in order for this code to work.


The next step would be to implement the SendMail() javascript function.


<script language=”javascript”>
function SendMail()
{
// save the values of the hidden variables from page A
// to the hidden variables in page B
// then call a postback with the id of our SendMail link button
__doPostBack(’SendMail’,’’);
}


This enables the javascript to store the value to the hidden variables first and then call a manual postback which would now take the new updated values and reflect it on the code behind. Effectively the user only has to click one button, which would first call a Javascript, change the values of the hidden form fields, and then do a postback with the new values reflected at the code behind.


Posted at DotNetJunkies on Wednesday, November 17, 2004 6:50 AM

Category : dotNet

ASP.NET Javascript value modification problem 2

February 20th, 2006 // 4:04 pm @

continued from my previous post …


I guessed as .NET viewstate is managed mostly using Javascript and GET / POST, there should be some way by which I can signify my hidden variables as dirty or refresh the viewstate to reflect the value changes by Javascript, before it is sent to the backend when the Send Message button is clicked. But no avail. I could not find any way to refresh or resync the viewstate using Javascript. I guess that should be because Viewstate is managed on the server so maybe we cannot modify it from the client and ask the server to resync with it.


So second approach, was to try to somehow add the values to a post queue. As new updated values will be send using a standard POST and ASP.NET will sync and update the ViewState internally. So that instead of accessing using ViewState, I can maybe access the updated Javascript values from the backend page using the old Request.Form method. But no avail. Still did not work.


Another idea was to create dynamic textboxes thru Javascripts, when the SendMail button is clicked and fill it with the value and then access them using Request.Form from the backend. But still the new values were not reflected.


Posted at DotNetJunkies on Tuesday, November 09, 2004 1:20 PM

Category : dotNet

ASP.NET, Javascript value modification problem 1

February 20th, 2006 // 4:02 pm @

While solving one particular case in a SharePoint webpart, I came across a very queer problem in ASP.NET Postback and Viewstate handling. Let me declare the scenario in detail :


I have a page A which has some values in hidden variables of type HtmlControls.HtmlInputHidden.


I popup a page B from page A using javascript window.open. Page B has a button called Send Mail which would send a mail to some recipients. The recipients list has to come from page A.


The standard way of passing data from one window to a javascript popup is querystring, but that is something which is not wanted. It has to work without querystring data passing, and as it is in SharePoint sessions are disabled by default, and hence passing by session is also not an option.


So the only option, is to keep a few hidden variables in page B, read the values from page A using window.opener from Javascript in page B, set the values of the hidden variables in page B, and then on click on Send Mail, access the hidden variables and send a mail using ASP.NET.


The funny problem, is that I can read the values from page A, using javascript. I can also set the values to the hidden variables ( verified by using and alert and checking the value of the hidden variable after it is set ), but as soon as I click Send Message, and try to access the value of the hidden variables from the backend ASP.NET code, the values set using Javascript are lost. On examination, the Viewstate seems to ignore the changes made to the Javascript, if the controls are hidden and does not pass it to the backend.


If the controls are like ASP.NET Textboxes, it works properly, but if they are hidden, again the same problem as above occurs. So definitely it not something exclusive for non .NET Controls.


More on this later on how I solved it when I take my next break :)


Posted on DotNetJunkies at Tuesday, November 09, 2004 1:12 PM

Category : dotNet

O/R Mapping

February 20th, 2006 // 3:34 pm @

While doing a research on O/R Mapping and what exactly it is, I came across an excellent post by Frans Bouma at http://weblogs.asp.net/fbouma/archive/2004/10/09/240225.aspx . A excellent piece and explained in a very practical way.


A must read for anyone who uses ADO and database access in the Microsoft world which unfortunately simply ignores these fantastic concepts to work with data applications. Will definitely broaden up your view and give you a new perspective to your application design.


Posted at DotNetJunkies on Tuesday, October 19, 2004 2:26 PM

Category : Miscellaneous

Configuring Word Automation

February 20th, 2006 // 3:32 pm @

I found some of these links valuable in trying to configure the server to support word automation.


INFO: Considerations for Server-Side Automation of Office
http://support.microsoft.com/kb/257757/EN-US/


How To Configure Office Applications to Run Under the Interactive User Account
http://support.microsoft.com/default.aspx?scid=kb;EN-US;288366


How to configure Office applications to run under a specific user account
http://support.microsoft.com/default.aspx?scid=kb;EN-US;288367


How to configure Office applications for automation from a COM+/MTS package
http://support.microsoft.com/default.aspx?scid=kb;EN-US;288368


Posted at DotNetJunkies on Wednesday, October 13, 2004 4:41 PM

Category : Miscellaneous

Word Automation Code

February 20th, 2006 // 3:30 pm @


Here is the sample code to get Word Automation working. Assuming that you have already added the reference to the Word dll‘s to your project.

Create a datasource file (*.odc) in Word by choosing Mail Merge option, and when it asks to select a data source, choose to create a new one and save the .odc file to your web folder. Store the password in the file and do not select any specific table in it.

Word.Application wrdApp;
Word._Document wrdDoc;

object oMissing = System.Reflection.Missing.Value;
object oFalse = false;
object oTrue = true;

Word.MailMerge wrdMailMerge;


// Create an instance of Word
wrdApp = new Word.Application();
wrdApp.Visible =
false;

// Open the template document.
string TemplateFile = TemplateFilePath + selectedTemplate;
object oFile = Server.MapPath(TemplateFile); wrdDoc = wrdApp.Documents.Open(ref oFile, ref oMissing,ref oTrue, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref oMissing);

wrdDoc.Select();
wrdMailMerge = wrdDoc.MailMerge;

// Create a MailMerge Data file.
object oSql = “Select * from “ + viewName + ” where Account <> ‘NULL’”;
string ODCFile = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["ODCFile"]); wrdDoc.MailMerge.OpenDataSource(ODCFile,ref oMissing,ref oMissing,ref oFalse,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oMissing,ref oSql,ref oMissing,ref oFalse,ref oMissing);

wrdMailMerge.SuppressBlankLines = true;


// Perform mail merge.
wrdMailMerge.Destination = Word.WdMailMergeDestination.wdSendToPrinter;
wrdMailMerge.Execute(
ref oFalse);

if(wrdDoc != null)
{

wrdDoc.Saved = true;
wrdDoc.Close(
ref oFalse,ref oMissing,ref oMissing);

}

if(wrdApp != null)
{

wrdApp.Quit(ref oFalse,ref oMissing,ref oMissing);

}

// Release References.
wrdMailMerge = null;
wrdDoc =
null;
wrdApp =
null;

Posted at DotNetJunkies on Wednesday, October 13, 2004 4:35 PM

Category : Miscellaneous

Blog Configuration progress

February 20th, 2006 // 3:21 pm @

I have decided to halt the configuration process till I hear something back from Yahoo about the permalinks not working. Lets see what they say.


Will be migrating content from my other blogs to this blog next. Instead of migrating all the posts, I will try and copy paste selected posts.

Category : General

Latest Posts

Testimonials

"Amar clearly has a thorough knowledge of Sharepoint, this knowledge, coupled with his professionalism and dedication made him a tremendous asset to the project. He was the key contributor to the later stages of the project delivery effort (the really difficult bit, long hours and hard work that puts huge demands on people), and I can state categorically that without his focussed dedication and hard work we would not have been able to meet the timescales imposed upon the project."

Tim Ellis , Sharepoint Project Manager , Royal Bank of Scotland

Subscribe Now