Tuesday, October 29, 2013

Useful links on LINQ TO XML, MVC 3, XML

Reading XML + LINQ
Reading XML and LINQ 1
Reading XML and LINQ 2

 Linq to XML
LINQ to XML 1
LINQ to XML 2
LINQ to XML 3
LINQ to XML 4
LINQ to XML 5
LINQ to XML 6
LINQ to XML 7
LINQ to XML 8
LINQ to XML 9
LINQ to XML 10
LINQ to XML 11

Linq to XML + Excel
LINQ to XML and Excel 1

ASP.NET MVC + XML
ASP.NET MVC and XML 1
ASP.NET MVC and XML 2

CRUD + XML + ASP.NET MVC3
CRUD, XML and ASP.NET MVC 3

Samsung Service Center in Manila and Makati, Philippines

http://www.samsung.com/ph/support/location/supportServiceLocation.do

1    PHONEVILLE MOBILE INC.     Unit 003 Ground Floor Cyberzone Area SM City Manila   
2    WSI PHONECARE, INC.    Samsung Customer Service Unit CZ-018, Lower G/F, SM City Manila   

1    SERVCARE SOLUTIONS PHILIPPINES INC.    Jaka Center, #2111 Don Chino Roces (Pasong Tamo), Makati City   
2    WELLCOM TELECOM SUPERMARKET INC.    Laptop Zone, Parksquare, Ayala (front of Glorietta 1)   
3    WSI PHONECARE, INC.    7F SEDCCO Bldg., Rada corner Legaspi Sts., Legaspi Village, Makati City   

HP Service Centers in the Philippines

http://www8.hp.com/ph/en/contact-hp/office-locations.html#2
Main office:
37th Floor Robinsons Summit Center
6783 Ayala Avenue
Makati City, Philippines

Trunk Line: (632) 888-5900
Fax Line: 830-7300

8:30am to 5:30pm / Monday to Friday
Two and Three World Square
22 Upper McKinley Road, McKinley Hill Town Center, Fort Bonifacio,
Taguig City 1634
Reception: (632) 902-6000

Intellectual Property Center
28 Upper Mckinley Road, Mckinley Hill Town Center, Fort Bonifacio
Taguig City 1634
Reception: (632) 718-7073

HP Service Centers:
GF Accelerando Building,
395 Sen. Gil Puyat Avenue, Makati City

Tel. No. (632) 888-6100
Unit C-D-E Ground Floor
Capitol Centrum Bldg.
Clavano cor. Escario St. Cebu City

Tel. No. (032) 254-4548 or (032) 412-5300

Thursday, October 24, 2013

Useful links for .NET Programmer

ReportViewer 2012 AND IIS 7
ReportViewer 2012 AND IIS 7 Reference #1
ReportViewer 2012 AND IIS 7 Reference #2

Logging Error in ASP.NET
Logging Error in ASP.NET Reference 1
Logging Error in ASP.NET Reference 2
Logging Error in ASP.NET Reference 3
Logging Error in ASP.NET Reference 4
Logging Error in ASP.NET Reference 5

Hover Menu Extender sample
Hover Menu Extender sample

Remove annoying arrow at menu
Remove annoying arrow at menu

SKyDrive Sample Codes
SKyDrive Sample Codes Reference 1
SKyDrive Sample Codes Reference 2

HoverMenuExtender
HoverMenuExtender Reference 1
HoverMenuExtender Reference 2
HoverMenuExtender Reference 3
HoverMenuExtender Reference 4

Showing Images on MouseOver
Showing Images on MouseOver

Cache, Session and Viewstate
 Cache, Session and Viewstate

Loading Related Entities
Loading Related Entities

 ASP.NET Session Timeout
ASP.NET Session Timeout

 ASP.NET Viewstate
 ASP.NET Viewstate Reference 1
  ASP.NET Viewstate Reference 2

Cell padding
Cell padding

vertical align css 3
vertical align css 3

Ajax-Based JavaScript File Uploader with Progress Bar
 Ajax-Based JavaScript File Uploader with Progress Bar

 jQuery File Upload Plugin
jQuery File Upload Plugin

ASP.NET File Upload with Progress Bar
ASP.NET File Upload with Progress Bar

FileUpload
FileUpload Reference 1
FileUpload Reference 2
FileUpload Reference 3

 flex container
 flex container

Chosen Plugin Dropdownlist?
Chosen Plugin Dropdownlist?

Textbox Autocomplete
Textbox Autocomplete

 ASp.NEt Autocomplete Dropdownlist
 ASp.NEt Autocomplete Dropdownlist

Validator for Checkboxlist references:
Validator for Checkboxlist References 1
Validator for Checkboxlist References 2
Validator for Checkboxlist References 3
Validator for Checkboxlist References 4

Guid password generator
Guid Password Generator

Monday, August 19, 2013

Migrating old source code of Visual Studio 2010 to Visual Studio 2012

Step 1: Enable nuget restore. Find and click on Project then find and click enable nuget restore.

Step 2: Manage nuget packages and install entityframework and ajaxcontroltoolkit.

Step 3. Download and install ajaxcontroltoolkit 4.5.

Step 4: Click on Toolbox then choose item, browse and find AjaxControlToolkit.dll version 4.5.

Step 5: Add reference to all dll that you need in your project and can be found here, C:\Program Files (x86)\Microsoft Visual Studio 11.0\. For example,
Microsoft.ReportViewer.Common
Microsoft.ReportViewer.WebForms
System.Data.Entity

Step 6: Select a page to set as start page.

Step 7: Replace the following align or valign with vertical and text-align respectively.
Refer to this link,
 My other blog

Step 8: There are items to change in css 3 from css 1, like cursor:hand to cursor:pointer.
Browser Support
To align right,
click here

Step 9: To deploy or publish the web application. Please refer to the link below,
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5

Step 10: Check for any missing dll. If you cannot find some of them, refer to this link below,
Reference 1

Step 11: To position two column table in the center at the top menu, add this css to menu.css file. .wrapper { position: absolute; left: 50%; margin-left: -70px; } the idea came from this link,
Align Contents

Step 12: When you wish to insert a image as a background, insert into a css file, this css below, background: url(../Images/ERRPAGE.png) center no-repeat;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
background-size: auto auto;
Reference used:
background size
vertical centering

Step 13: If you receive an error message "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack", apply this code before your redirect to error page like this code below,
if (ex.Message.StartsWith("Thread") == false)
{
Session["ErrorMessage"] = ex.Message;
Response.Redirect("~/Forms/Error.aspx", false);
}
Reference used for step 13,
Reference used

Step 14: to change the color of the scrollbar of a panel, use the link below,
Bar color
CSS Tutorial
There is no direct way of changing color of scrollbar in a treeview control unless you create new custom treeview control.

Step 15: In case you have this javascript error message "0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed.", you can insert this meta tag in the master page,
 <meta http-equiv="X-UA-Compatible" content="IE=9" />
Step 16: To enable clicking on word displayed to expand the tree. Set the property SelectAction to Expand. To display the treeview in unexpanded format. Set the property Expanded to False.
<asp:TreeNode Text="Transaction" Value="Process" ImageUrl="~/Images/folder.png" Expanded="false" SelectAction="Expand" >
Step 17: To remove the default arrows that appear in the ASP.NET Menu Control. Set the StaticEnableDefaultPopOutImage property to False. This property is responsible for the default arrows that appear in the ASP.NET Menu control. To remove the default arrows that appear in the ASP.NET menu items. Set the DynamicEnableDefaultPopOutImage property to False. This property gets or sets a value indicating whether the built-in image that indicates that a dynamic menu item has a submenu is displayed.

Reference used for step 17:
Reference for DynamicEnableDefaultPopOutImage
Reference for StaticEnableDefaultPopOutImage
Another Reference for StaticEnableDefaultPopOutImage

Step 18: Fixing the displaying of rdlc inside a report viewer 2012 using IIS 7. Please refer to this link to add handler mappings at iis.

Step 19: To display Elmah.axd, allow remote access by setting allowRemoteAccess from false to true at web config file. And add a file extension to allow . Find and click Request Filtering. Find and click Allow file name extension link. Type in .axd at File name extension and then click OK.

Step 20: To insert space between menu and submenu, put some value at DynamicMenuItemStyle-HorizontalPadding  property.
Reference used for step 20

Migrating from Visual Studio 2010 to Visual Studio 2012
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5
Reference 6

Monday, July 8, 2013

Migrating to HTML 5 using ASP.NET 4.5

Let us say, you have previous aspx page that you copy and paste. You use HTML 5 in visual studio 2012. When you try to compile, it will give you a compile error.
Please change align="left" to style="text-align:left". Please change align="right" to style="text-align:right". Please change align="center" to style="text-align:center".

Migrating from EF 4 to EF 4.5

If you do have a previous class that uses entity framework in visual studio 2010. Then you need to create the same class using visual studio 2012. When you try to copy and paste into the new class. Then compile it, it will give you an error. In visual studio 2010 Addto<tablename> method and DeleteObject method no longer exist. Please use <tablename>.Add method and <tablename>.Remove method respectively. For insert, user add method and for delete, use remove method.

Tuesday, May 28, 2013

How to validate an Ajax control combo box has item selected or not?



First, you need to insert beside the combo box a custom validator like this,

<asp:CustomValidator ID="cv" runat="server" ControlToValidate="cmb" Text="*" ForeColor="Red" ValidateEmptyText="true" ClientValidationFunction="CustomValidator" Display="Dynamic" ErrorMessage="combo box is required!" CssClass="validator" ValidationGroup="valGrp"></asp:CustomValidator>

If your combo box default selected value is an empty string then you need to add a function inside a <script type="text/javascript"> like this,

    function CustomValidator(s, e) {
        if ($find(s.controltovalidate)._textBoxControl.value == "") {
            e.IsValid = false;
        }
    }

If your combo box default value of “Please select” then you need to add a function inside a <script type="text/javascript”> like this,

    function CustomValidator(s, e) {
        if ($find(s.controltovalidate)._textBoxControl.value == "Please select") {
            e.IsValid = false;
        }
    }

References used:

Monday, May 13, 2013

How fix the column width in a gridview at insert tooltip in each cell in Asp.net 4?




If you need to set the width of each column in a gridview control,  If the column is just to display and no editing needed. You can like this,

<asp:TemplateField HeaderText="column Name" SortExpression="fieldname">
<HeaderTemplate>
       <div style="text-align:center;background-color:#41627E;color:White;font-size:x-small;font-weight:bold;overflow: hidden;white-space: nowrap;width: 50px;" >column Name</div>
</HeaderTemplate>
<ItemTemplate>
<div style="font-size:xx-small;white-space:nowrap;overflow: hidden;text-align:left;font-weight:600;font-family:Tahoma;width: 50px;" >
 <asp:Label ID="lblGridColumnName" runat="server" Text='<%# Bind("fieldname") %>' ></asp:Label>
</div>
</ItemTemplate>
</asp:TemplateField>


But if there is a editing to be done, you need to do like this,

<asp:TemplateField HeaderText="column Name" SortExpression="fieldname">
<HeaderTemplate>
<div style="text-align:center;background-color:#41627E;color:White;font-size:x-small;font-weight:bold;overflow: hidden;white-space: nowrap;width: 40px;" >column name</div>
</HeaderTemplate>
<ItemTemplate>
<div style="font-size:xx-small;white-space:nowrap;overflow: hidden;text-align:left;font-weight:600;font-family:Tahoma;width: 40px;" >
<asp:Label ID="lblGridColumnName" runat="server" Text='<%# Bind("fieldname", "{0:n0}") %>'></asp:Label>
</div>
</ItemTemplate>
<EditItemTemplate>
              <asp:TextBox ID="txtGridColumnName" runat="server" Text='<%# Eval("fieldname", "{0:n0}") %>' Width="50px" CssClass="cssclass" />
       </EditItemTemplate>
</asp:TemplateField>


If you need insert a tooltip for each cell inside a gridview, you need to set each column tooltip. You can do like this,

protected void gv_DataBound(object sender, EventArgs e)
{
Label lbl = new Label();
foreach (GridViewRow rv in gv.Rows)
{
lbl = (Label)rv.FindControl("lblGridColumnName ");
rv.Cells[1].ToolTip = lbl == null ? string.Empty : lbl.Text;
}
}

Wednesday, October 10, 2012

How to manipulate back button in ASP.NET 4?

After searching a lot of references. I have came to a conclusion that you can only prevent user from accessing the previous page is thru javascript window history. You can not manipulate the forward button but only the back button. There are many ways to do it, if you really want to manipulate both button is to clear cache like this,
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
Response.Expires = 0;
Response.CacheControl = “no-cache”;

To manipulate the previous page (back button) is thru this way,

<script type="text/javascript" language="javascript">
function DeleteHistory() {
window.history.go('Default.aspx');
}
setTimeout("DeleteHistory()", 1000);
window.onunload = function () { DeleteHistory(); };
</script>

Here are references that I have used:
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Reference 10
Reference 11

Javascript back button asp.net
Reference 12
Reference 13
Reference 14
Reference 15
Reference 16
Reference 17
Reference 18
Reference 19

Tuesday, May 8, 2012

Optimize performance of your Entity Framework 4 on Client Side


If you want to improve the perforamance of your entity framework in client side, you can use Cache from
System.Web.Caching.Cache object. If you like to reset values,
Cache.Remove("Name of your Cache");
If you wish to store the value to a cache,
if (Cache.Get("Name of your Cache") == null)
    Cache.Insert("Name of your Cache", object);
Where your object can be dataset or datatable or list.
You can determine which part of your code that needs to refactor your existing code using Entity Framework Profiler.
Entity Framework Profiler
Reference 1
Reference 2
Reference 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Reference 10
Reference 11
Reference 12
Reference 13
Reference 14

Thursday, April 12, 2012

Troubleshooting your rdlc inside Visual Studio 2010.

In order to troubleshoot your rdlc inside Visual Studio 2010.
Problem: how to make table invisible when there is no row.

Solution:  Set the expression for the row,
=IIF(Fields!BILLER.Value is nothing, true, false)
Step 1: Right click the tablix, choose and click row visibility.
Step 2: Choose and click the button beside “Show or hide based on an expression”.
Step 3: Enter the expression, =IIF(Fields!BILLER.Value is nothing, true, false).

Problem 2: How to display the image inside the report viewer.

Solution: You need to set the UI culture and culture for an individual page, set the Culture and UICulture attributes of the @ Page directive, as shown in the following example:
<%@ Page UICulture="es" Culture="es-MX" %>
To insert image on the report itself.
Step 1: Right click and choose insert then choose and click on image.
Step 2: Click on import button.
Step 3: Choose and click on the image.

Problem 3: How to create a variable that will make computations, like quantity multiply price equals sales.

Solution:
Step 1: Find and Click on Report Properties.
Step 2: Find and click onVariables.
Step 3: Click Add Button.
Step 4: Enter your chosen name. Then click on “fx” button.
Step 5: Enter your expression after the equal sign.

References used:
Reference 1
Reference 2
References 3
Reference 4
Reference 5
Reference 6
Reference 7
Reference 8
Reference 9
Note: I will include the images in this post next time.

Saturday, April 7, 2012

Useful links for SQL Server 2008 and Visual Studio 2010 Service Pack

SQL Server 2008 SP1

SQL Server 2008 SP2

SQL Server 2008 SP3

SQL Server 2008 R2 SP1

SQL Server 2008 R2 SP2

Microsoft SQL Server 2008 SP2 Reporting Services Report Builder

Microsoft Visual Studio 2010 Service Pack 1

Security Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2645410)

Update for Microsoft Visual Studio 2010 Service Pack 1 Report Viewer (KB2549864)

Visual Studio 2010 Performance Tools with Service Pack 1

Visual Studio 2010 Remote Debugger with Service Pack 1

Update for Microsoft Visual Studio 2010 Service Pack 1 Web Platform Tools

Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2635973)

Microsoft Visual Studio 2010 Service Pack 1 MFC Security Update

Update for Microsoft Visual Studio 2010 Service Pack 1 (KB2529927)

Update for Microsoft Visual Studio 2010 Service Pack 1 TFS Build Explorer (KB2522890)

Microsoft Report Viewer Redistributable 2005 Service Pack 1

Microsoft Report Viewer 2008 SP1 Redistributable

Microsoft SQL Server 2008 R2

Microsoft Report Viewer 2010 Redistributable Package

.NET Framework 4

Microsoft .NET Framework 4 KB2468871

Update 4.0.2 for Microsoft .NET Framework 4 – Design-time Update for Visual Studio 2010 SP1 (KB2544525)

Multi-Targeting Pack for Microsoft .NET Framework 4.0.2 (KB2544526)

Microsoft .NET Framework 4 Platform Update 1 – Design-time Update for Visual Studio 2010 SP1 (KB2495593)

Update 4.0.2 for Microsoft .NET Framework 4 – Runtime Update (KB2544514)

Microsoft .NET Framework 4 Platform Update 1 - Runtime Update (KB2478063)

Monday, September 5, 2011

Useful System SPs of SQL Server 2005

sp_add_data_file_recover_suspect_db (Transact-SQL)
Adds a data file to a filegroup when recovery cannot complete on a database due to insufficient space on the file group (error 1105). After the file is added, this stored procedure turns off the suspect setting and completes the recovery of the database. The parameters are the same as those for ALTER DATABASE database_name ADD FILE.
Click this link

sp_addextendedproc (Transact-SQL
Registers the name of a new extended stored procedure to Microsoft SQL Server.
Click this link

sp_addextendedproperty (Transact-SQL)
Adds a new extended property to a database object.
Click this link

sp_add_log_file_recover_suspect_db (Transact-SQL)
Adds a log file to a file group when recovery cannot complete on a database due to insufficient log space (error 9002). After the file is added, sp_add_log_file_recover_suspect_db turns off the suspect setting and completes the recovery of the database. The parameters are the same as those for ALTER DATABASE database_name ADD LOG FILE.
Click this link

sp_addmessage (Transact-SQL)
Stores a new user-defined error message in an instance of the SQL Server Database Engine. Messages stored by using sp_addmessage can be viewed by using the sys.messages catalog view.
Click this link

sp_addtype (Transact-SQL)
Creates an alias data type.
Click this link

sp_addumpdevice (Transact-SQL)
Adds a backup device to an instance of the Microsoft SQL Server 2005 Database Engine.
Click this link

sp_altermessage (Transact-SQL)
Alters the state of user-defined messages in an instance of the SQL Server Database Engine. User-defined messages can be viewed using the sys.messages catalog view.
Click this link

sp_attach_db (Transact-SQL)
Attaches a database to a server.
Click this link

sp_attach_single_file_db (Transact-SQL)
Attaches a database that has only one data file to the current server. sp_attach_single_file_db cannot be used with multiple data files.
Click this link

sp_autostats (Transact-SQL)
Displays or changes the automatic UPDATE STATISTICS setting for a specific index and statistics, or for all indexes and statistics for a specified table or indexed view in the current database.
Click this link

sp_batch_params (Transact-SQL)
Returns a rowset that contains information about the parameters included in a Transact-SQL batch. sp_batch_params only parses the batch specified and returns information about embedded parameter values. It does not execute the batch or modify the execution environment.
Click this link

sp_bindefault (Transact-SQL)
Binds a default to a column or to an alias data type.
Click this link

sp_bindrule (Transact-SQL)
Binds a rule to a column or to an alias data type.
Click this link

sp_bindsession (Transact-SQL)
Binds or unbinds a session to other sessions in the same instance of the SQL Server Database Engine. Binding sessions allows two or more sessions to participate in the same transaction and share locks until a ROLLBACK TRANSACTION or COMMIT TRANSACTION is issued.
Click this link

sp_certify_removable (Transact-SQL)
Verifies that a database is correctly configured for distribution on removable media and reports any problems to the user.
Click this link

sp_configure (Transact-SQL)
Displays or changes global configuration settings for the current server.
Click this link

sp_control_plan_guide (Transact-SQL)
Drops, enables, or disables a plan guide.
Click this link

sp_create_plan_guide (Transact-SQL)
Creates a plan guide for associating query hints with queries in a database.
Click this link

sp_create_removable (Transact-SQL)
Creates a removable media database. Creates three or more files (one for the system catalog tables, one for the transaction log, and one or more for the data tables) and places the database on those files.
Click this link

sp_createstats (Transact-SQL)
Creates single-column statistics for all eligible columns for all user tables and internal tables in the current database. The new statistic has the same name as the column where it is created.
Click this link

sp_datatype_info (Transact-SQL)
Returns information about the data types supported by the current environment.
Click this link

sp_db_vardecimal_storage_format (Transact-SQL)
Returns the current vardecimal storage format state of a database, or enables or disables a database for vardecimal storage format. Requires SQL Server 2005 Service Pack 2 or later versions. Vardecimal storage format is available only in SQL Server 2005 Enterprise, Developer, and Evaluation editions.
Click this link

sp_dbcmptlevel (Transact-SQL)
Sets certain database behaviors to be compatible with the specified version of SQL Server.
Click this link

sp_dbmmonitoraddmonitoring (Transact-SQL)
Creates a database mirroring monitor job that periodically updates the mirroring status for every mirrored database on the server instance.
click this link

sp_dbmmonitorchangealert (Transact-SQL)
Adds or changes warning threshold for a specified mirroring performance metric.
Click this link

sp_dbmmonitorchangemonitoring (Transact-SQL)
Changes the value of a database mirroring monitoring parameter.
Click this link

sp_dbmmonitordropalert (Transact-SQL)
Drops the warning for a specified performance metric, by setting the threshold to NULL.
Click this link

sp_dbmmonitordropmonitoring (Transact-SQL)
Stops and deletes the mirroring monitor job for all the databases on the server instance.
Click this link

sp_dbmmonitorhelpalert (Transact-SQL)
Returns information about warning thresholds on one or all of several key database mirroring monitor performance metrics.
Click this link

sp_dbmmonitorhelpmonitoring (Transact-SQL)
Returns the current update period.
Click this link

sp_dbmmonitorresults (Transact-SQL)
Returns status rows for a monitored database from the status table in which database mirroring monitoring history is stored and allows you to choose whether the procedure obtains the latest status beforehand.
Click this link

sp_dbmmonitorupdate (Transact-SQL)
Updates the database mirroring monitor status table by inserting a new table row for each mirrored database, and truncates rows older than the current retention period. The default retention period is 7 days (168 hours). When updating the table, sp_dbmmonitorupdate evaluates the performance metrics.
Click this link

sp_dboption (Transact-SQL)
Displays or changes database options. Do not use sp_dboption to modify options on either the master database or the tempdb database.
Click this link

sp_dbremove (Transact-SQL)
Removes a database and all files associated with that database.
Click this link

sp_delete_backuphistory (Transact-SQL)
Reduces the size of the backup and restore history tables by deleting the entries for backup sets older than the specified date. Additional rows are added to the backup and restore history tables after each backup or restore operation is performed; therefore, we recommend that you periodically execute sp_delete_backuphistory.
Click this link

sp_delete_database_backuphistory (Transact-SQL)
Deletes information about the specified database from the backup and restore history tables.
Click this link

sp_depends (Transact-SQL)
Displays information about database object dependencies, such as: the views and procedures that depend on a table or view, and the tables and views that are depended on by the view or procedure. References to objects outside the current database are not reported.
Click this link

sp_detach_db (Transact-SQL)
Detaches a database that is currently not in use from a server instance and, optionally, runs UPDATE STATISTICS on all tables before detaching.
Click this link

sp_dropdevice (Transact-SQL)
Drops a database device or backup device from an instance of the SQL Server 2005 Database Engine, deleting the entry from master.dbo.sysdevices.
Click this link

sp_dropextendedproc (Transact-SQL)
Drops an extended stored procedure.
Click this link

sp_dropextendedproperty (Transact-SQL)
Drops an existing extended property.
Click this link

sp_dropmessage (Transact-SQL)
Drops a specified user-defined error message from an instance of the SQL Server Database Engine. User-defined messages can be viewed using the sys.messages catalog view.
Click this link

sp_droptype (Transact-SQL)
Deletes an alias data type from systypes.
Click this link

sp_estimated_rowsize_reduction_for_vardecimal (Transact-SQL)
Estimates the reduction in the average size of rows if enable vardecimal storage format is enabled on a table. Use this number to estimate the overall reduction in the size of the table. Because the statistical sampling is used to compute the average reduction in the rowsize, regard it as an estimate only. In rare cases, rowsize may increase after you enable the vardecimal storage format. Vardecimal storage format is available only in SQL Server 2005 Enterprise, Developer, and Evaluation editions.
Click this link

sp_executesql (Transact-SQL)
Executes a Transact-SQL statement or batch that can be reused many times, or one that has been built dynamically. The Transact-SQL statement or batch can contain embedded parameters.
Click this link

sp_get_query_template
Returns the parameterized form of a query. The results returned mimic the parameterized form of a query that results from using forced parameterization. sp_get_query_template is used primarily when you create TEMPLATE plan guides.
Click this link

sp_getapplock (Transact-SQL)
Places a lock on an application resource.
Click this link

sp_getbindtoken (Transact-SQL)
Returns a unique identifier for the transaction. This unique identifier is a string used to bind sessions using sp_bindsession.
Click this link

sp_help (Transact-SQL)
Reports information about a database object (any object listed in the sys.sysobjects compatibility view), a user-defined data type, or a data type supplied by SQL Server 2005.
Click this link

sp_helpconstraint (Transact-SQL)
Returns a list of all constraint types, their user-defined or system-supplied name, the columns on which they have been defined, and the expression that defines the constraint (for DEFAULT and CHECK constraints only).
Click this link

sp_helpdb (Transact-SQL)
Reports information about a specified database or all databases.
Click this link

sp_helpdevice (Transact-SQL)
Reports information about Microsoft® SQL Server™ backup devices.
Click this link

sp_helpextendedproc (Transact-SQL)
Reports the currently defined extended stored procedures and the name of the dynamic-link library (DLL) to which the procedure (function) belongs.
Click this link

sp_helpfile (Transact-SQL)
Returns the physical names and attributes of files associated with the current database. Use this stored procedure to determine the names of files to attach to or detach from the server.
Click this link

sp_helpfilegroup (Transact-SQL)
Returns the names and attributes of filegroups associated with the current database.
Click this link

sp_helpgroup (Transact-SQL)
Reports information about a role, or all roles, in the current database.
Click this link

sp_helpindex (Transact-SQL)
Reports information about the indexes on a table or view.
Click this link

sp_helplanguage (Transact-SQL)
Reports information about a particular alternative language or about all languages.
Click this link

sp_helpserver (Transact-SQL)
Reports information about a particular remote or replication server, or about all servers of both types. Provides the server name, the network name of the server, the replication status of the server, the identification number of the server, and the collation name. Also provides time-out values for connecting to, or queries against, linked servers.
Click this link

sp_helpsort (Transact-SQL)
Displays the sort order and character set for the instance of SQL Server 2005.
Click this link

sp_helpstats (Transact-SQL)
Returns statistics information about columns and indexes on the specified table.
Click this link

sp_helptext (Transact-SQL)
Displays the definition of a user-defined rule, default, unencrypted Transact-SQL stored procedure, user-defined Transact-SQL function, trigger, computed column, CHECK constraint, view, or system object such as a system stored procedure.
Click this link

sp_helptrigger (Transact-SQL)
Returns the type or types of DML triggers defined on the specified table for the current database. sp_helptrigger cannot be used with DDL triggers. Query the sys.triggers (Transact-SQL) catalog view instead.
Click this link

sp_indexoption (Transact-SQL)
Sets locking option values for user-defined clustered and nonclustered indexes or tables with no clustered index.
The SQL Server 2005 Database Engine automatically makes choices of page-, row-, or table-level locking. You do not have to set these options manually. sp_indexoption is provided for expert users who know with certainty that a particular type of lock is always appropriate.
Click this link

sp_invalidate_textptr (Transact-SQL)
Invalidates the specified in-row text pointer, or all in-row text pointers, in the transaction. sp_invalidate_textptr can be used only on in-row text pointers. These pointers are from tables that have the text in row option enabled.
Click this link

sp_lock (Transact-SQL)
Reports information about locks.
Click this link

sp_monitor (Transact-SQL)
Displays statistics about Microsoft SQL Server.
Click this link

sp_procoption (Transact-SQL)
Sets stored procedure for autoexecution. A stored procedure that is set to autoexecution runs every time an instance of SQL Server is started.
Click this link

sp_recompile (Transact-SQL)
Causes stored procedures and triggers to be recompiled the next time they are run.
Click this link

sp_refreshsqlmodule (Transact-SQL)
Updates the metadata for the specified nonschema-bound stored procedure, user-defined function, or view. Persistent metadata for these objects, such as data types of parameters, can become outdated because of changes to their underlying objects.
Click this link

sp_refreshview (Transact-SQL)
Updates the metadata for the specified non-schemabound view. Persistent metadata for a view can become outdated because of changes to the underlying objects upon which the view depends.
Click this link

sp_releaseapplock (Transact-SQL)
Releases a lock on an application resource.
Click this link

sp_rename (Transact-SQL)
Changes the name of a user-created object in the current database. This object can be a table, index, column, alias data type, or Microsoft .NET Framework common language runtime (CLR) user-defined type.
Click this link

sp_renamedb (Transact-SQL)
Changes the name of a database.
Click this link

sp_resetstatus (Transact-SQL)
Resets the status of a suspect database.
Click this link

sp_setnetname (Transact-SQL)
Sets the network names in sys.servers to their actual network computer names for remote instances of SQL Server 2005. This procedure can be used to enable execution of remote stored procedure calls to computers that have network names containing SQL Server identifiers that are not valid.
Click this link

sp_settriggerorder (Transact-SQL)
Specifies the AFTER triggers that are fired first or last. The AFTER triggers that are fired between the first and last triggers are executed in undefined order.
Click this link

sp_spaceused (Transact-SQL)
Displays the number of rows, disk space reserved, and disk space used by a table, indexed view, or SQL Server 2005 Service Broker queue in the current database, or displays the disk space reserved and used by the whole database.
Click this link

sp_tableoption (Transact-SQL)
Sets option values for user-defined tables. sp_tableoption can be used to control the in-row behavior of tables with varchar(max), nvarchar(max), varbinary(max), xml, text, ntext, or image columns.
Click this link


sp_unbindefault (Transact-SQL)
Unbinds, or removes, a default from a column or from an alias data type in the current database.
Click this link

sp_unbindrule (Transact-SQL)
Unbinds a rule from a column or an alias data type in the current database.
Click this link

sp_updateextendedproperty (Transact-SQL)
Updates the value of an existing extended property.
Click this link

sp_updatestats (Transact-SQL)
Runs UPDATE STATISTICS against all user-defined and internal tables in the current database.
Click this link

sp_validname (Transact-SQL)
Checks for valid SQL Server 2005 identifier names. All nonbinary and nonzero data, including Unicode data that can be stored by using the nchar, nvarchar, or ntext data types, are accepted as valid characters for identifier names.
Click this link

sp_who (Transact-SQL)
Provides information about current users, sessions, and processes in an instance of the Microsoft SQL Server Database Engine. The information can be filtered to return only those processes that are not idle, that belong to a specific user, or that belong to a specific session.
Click this link

Wednesday, August 10, 2011

How to insert or add URL links inside the gridview?

There are many ways to insert or add links inside a grid. There are many ways to display all the pages in your site in a gridview.
This is one way,
<asp:HyperLinkField DataTextField="Modules" HeaderText="Name" NavigateUrl='<% Bind("URL") %>' />

This the second way to do this,
                                                                    <asp:TemplateField HeaderText="Name" SortExpression="Modules">
                                                                        <ItemTemplate>
                                                                            <asp:HyperLink ID="hlModules" runat="server" Text='<%# Bind("Modules") %>' />
                                                                        </ItemTemplate>
                                                                    </asp:TemplateField>

Then add this code in gridview RowCreated event,

if (e.Row.RowType == DataControlRowType.DataRow)
{
    HyperLink hl = (HyperLink)e.Row.FindControl("hlModules");
    hl.NavigateUrl = "MyPage.aspx";
}

But if you want to open the page in a new window or pop up. You need to put this code in RowDataBound event of the gridview and do like this,
           

if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink hl = (HyperLink)e.Row.FindControl("hlModules");
      switch(hl.Text)
      {
            case "FirstPage":
                  hl.NavigateUrl = "javascript:OpenFirstPage();";
            break;                       
            case "SecondPage":
                  hl.NavigateUrl = "javascript:OpenSecondPage();";
            break;                       
 
      }
}

Of course you need to create the javascript to open a pop up window like this,

<script type="text/javascript" language="javascript">
var winArray = new Array()
function OpenFirstPage()
{
if (!winArray[0] || winArray[0].closed)
      winArray[0] = window.open("FirstPage.aspx", "FirstPage", "width=800,height=600,toolbar=no, menubar=no, directories=no, resizable=yes, scrollbars=yes");
else
            winArray[0].focus();
}
function OpenSecondPage()
{
if (!winArray[0] || winArray[0].closed)
      winArray[0] = window.open("SecondPage.aspx", "SecondPage", "width=800,height=600,toolbar=no, menubar=no, directories=no, resizable=yes, scrollbars=yes");
else
            winArray[0].focus();
}
</script>

You may refer to my other post or blog on how to open popup or close all popup windows.