Friday, September 25, 2009

Retrieving Log Details Stored in SQL Server Database

In some scenarios we may store log details in SQL Server. Those data stored in the table named as "sysdtslog90".
Therefore you can retrieve those details using the below simple query
SELECT * FROM dbo.sysdtslog90

Sunday, September 20, 2009

Easy way to Customize MOSS 2007 Master Pages using SharePoint Designer 2007

Using SharePoint Designer 2007, you can easily customize your SharePoint Master pages. If you want to create a new master page you can easily do it. To do that first copy the default.master page and rename it to whatever name you want (Master page can be found at "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\GLOBAL").
Then go to the your SharePoint site and go to Site Settings. Click Master Pages under Galleries category and upload the renamed master page to the Master pages.

Then open the SharePoint Designer 2007 and click on the Open Site in the File menu.
Then copy the url of the your SharePoint site and open it in SharePoint Designer 2007. You can see the master pages of the site in the catalogs folder. Double click on the renamed master page to edit in SharePoint Designer.

Then you can customize that page according to your requirments. If you want to remove some parts in the master page, the best thing is comment those code instead of deleting those in the design mode. The reason is if we delete those in design mode it gives errors in the design mode or when we publish them.

After customizing the page click on Save. If you want to set the customized Master Page as the default master page, righ click on it and select "Set as Default Master Page".

That's all. After that you can use the customized master page for other SharePoint Web Applications too.

Thursday, September 10, 2009

Avoiding ASP.Net Browser Refresh Problem

Lets assume you delete an item in a gridview and you will get a confirmation message box to decide whether delete that item or not. After completing that task, refresh the page. Sometimes you will get the previous confirmation message box.
Same thing can happen when you insert particular record for a button click event. When you refresh the page that same record will be inserted again.

Below link contains a sample code to avoid it


Code:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)

{
if (!IsPostBack)
{
Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
}
}

protected void Button1_Click(object sender, EventArgs e)
{
if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
{
Label1.Text = "Hello";
Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
}
else
{
Label1.Text = "Page Refreshed";
}
}

protected void Page_PreRender(object sender, EventArgs e)
{
ViewState["CheckRefresh"] = Session["CheckRefresh"];
}
}
}

Tuesday, September 8, 2009

Adding Multivalued Parameter as a Filter for a SQL Server Report

To add a multivalue report parameter as filter for a SQL Report click Filters in Chart properties and add the Report Parameter as shown in the given figure.
The only difference is you have to choose the operator as "In". It set the the selected value to an array and filter the report