Monday, April 26, 2010

How to hide Validation summary at client side using Java Script?

The below script will help you to hide Validationsummary at client side .

How set focus to a control in a ModalPopupExtender while loading and hiding?(add_shown & add_hiding ModalPopupExtender Events )

In this topic, I’ll discuss the Client events we usually need while using ModalPopupExtender. The add_shown fires when the ModalPopupExtender had shown and add_hiding fires when the user cancels it by CancelControlID,note that it fires before hiding the modal.


They are useful in many cases, for example may you need to set focus to specific Textbox when the user display the modal, or if you need to reset the controls values inside the Modal after it has been hidden.

You can attach your fucntions  by using the Sys.Application.add_load(functionName)
Note :"functionName" should be the name of the function which is used to initialize the events add_hiding and add_shown of the ModalPopupExtender

Inside the fucntion "functionname" you can attach the your functions to the events like below



Please go through the full expample below to understand the woking of these events better.

Sunday, April 25, 2010

How check a constraint with if exixts in sql server 2005?

By using below script you will be able to check the contraint with if exist.

if not exists(SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME='CrmUserHirarchey' AND CONSTRAINT_NAME='FK_CrmUserHirarchey_aUsergroups' ) begin ALTER TABLE [dbo].[CrmUserHirarchey] WITH CHECK ADD CONSTRAINT [FK_CrmUserHirarchey_aUsergroups] FOREIGN KEY([UserGroupID], [CompanyId]) REFERENCES [dbo].[aUsergroups] ([UserGroupID], [CompanyID]) ALTER TABLE [dbo].[CrmUserHirarchey] CHECK CONSTRAINT [FK_CrmUserHirarchey_aUsergroups] end

How to append a double quotes to a string varibale in c# .net (“)?

You can add double quots to a string varibale in C# like below.

Please find below an example, how theses values is passed to a javascript fucntion to show it in message box while chicking on an image.

How to append a double quotes to a string in c# .net (“)?

You can add double quots to a  string in C# like below.
string Name = @"""Helloworld""";

Please find below an example, how theses values is passed to a javascript fucntion to show it in message box while chicking on an image.

Friday, April 23, 2010

Having trouble stepping into a stored procedure Visual studio (get canceled by user)

This error can be solved by adding your logged in user account as sysadmin user in SQL server .

How to assign value to asp.net literal or Label using JavaScript?

For an asp.net Label you can assign value using the innerText property


For an asp.net Literal you can assign value using the innerHTML property


How to add comments in my CSS (style sheet)?

CSS Commenting is very simple as any other language. Your comments should be in between /* and */. Here is an example of how to have comments
 /* this is a comment*/

Saturday, April 10, 2010

Showing Updateprogress in a model window using Ajax modal popup extender

The below code will help you you to show an Ajax update progress in a Modal popup extender like the screen shot below.
The below code assumes the current page is under a master page.
Source code

Thursday, April 8, 2010

Why UpdateProgress Not Showing?

In the following scenarios, the UpdateProgress control will not display automatically:

The UpdateProgress control is associated with a specific update panel, but the asynchronous postback results from a control that is not inside that update panel.

The UpdateProgress control is not associated with any UpdatePanel control, and the asynchronous postback does not result from a control that is not inside an UpdatePanel and is not a trigger. For example, the update is performed in code.

For making the ajax update progress to be working in the above senarion, follow as descibed below.

Underneath the "asp:ScriptManager" element, add the following script:

Replace 'UpdateProgress1' with your Udateprogressbar id and replace 'Button1' with your trigering control id.


More info can be found at
http://www.asp.net/AJAX/Documentation/Live/tutorials/ProgrammingUpdateProgress.aspx

Tuesday, April 6, 2010

Can view in SQL server 2005 be updated,inserted or deleted

Updatable Views
You can modify the data of an underlying base table through a view, as long as the following conditions are true:

Any modifications, including UPDATE, INSERT, and DELETE statements, must reference columns from only one base table.
The columns being modified in the view must directly reference the underlying data in the table columns. The columns cannot be derived in any other way, such as through the following:
An aggregate function: AVG, COUNT, SUM, MIN, MAX, GROUPING, STDEV, STDEVP, VAR, and VARP.
A computation. The column cannot be computed from an expression that uses other columns. Columns that are formed by using the set operators UNION, UNION ALL, CROSSJOIN, EXCEPT, and INTERSECT amount to a computation and are also not updatable.
The columns being modified are not affected by GROUP BY, HAVING, or DISTINCT clauses.
TOP is not used anywhere in the select_statement of the view together with the WITH CHECK OPTION clause.
The previous restrictions apply to any subqueries in the FROM clause of the view, just as they apply to the view itself. Generally, the Database Engine must be able to unambiguously trace modifications from the view definition to one base table. For more information, see Modifying Data Through a View.

If the previous restrictions prevent you from modifying data directly through a view, consider the following options:

INSTEAD OF Triggers
INSTEAD OF triggers can be created on a view to make a view updatable. The INSTEAD OF trigger is executed instead of the data modification statement on which the trigger is defined. This trigger lets the user specify the set of actions that must happen to process the data modification statement. Therefore, if an INSTEAD OF trigger exists for a view on a specific data modification statement (INSERT, UPDATE, or DELETE), the corresponding view is updatable through that statement. For more information about INSTEAD OF triggers, see Designing INSTEAD OF Triggers.
Partitioned Views
If the view is a partitioned view, the view is updatable, subject to certain restrictions. When it is needed, the Database Engine distinguishes local partitioned views as the views in which all participating tables and the view are on the same instance of SQL Server, and distributed partitioned views as the views in which at least one of the tables in the view resides on a different or remote server.
For more information about partitioned views, see Creating Partitioned Views.