Friday, March 28, 2014

Remove the AnchorTag Border

I have a AJAX Tab container and in that on selection its giving me a border on the Header Text of the Tab. To remove this using CSS, here is how we can do it

.ajax__tab_inner a.ajax__tab_tab{width:100%;border:0 !important;outline: none; }

a:focus { 
        outline: none; 

This is what will fix the issue. Hope this helps!

Thursday, March 27, 2014

How to change or add script tag source from C#?

Here is how we can add script to page header from code behind in c#. The reason why I am doing this is I have these JavaScript files included in master page. And when I try to give path of these files I am getting issues with absolute page when I got to other pages since I have these in master page.

and one more reason why I did is I don’t want to change this every time if deploy to different environment from QA, Stage and Production.

This is how we can do it in your master page.

string js1 = HttpContext.Current.Request.ApplicationPath + "/Scripts/jquery.cycle2.js";
string js2 = HttpContext.Current.Request.ApplicationPath + "/Scripts/jquery.countdown.js";

Literal js1script = new Literal();
js1script.Text = string.Format(
@"<script src=""{0}"" type=""text/javascript""></script>", js1);

Literal js2script = new Literal();
js2script.Text = string.Format(
@"<script src=""{0}"" type=""text/javascript""></script>", js2);

Hope this is useful!!

Tuesday, March 11, 2014

How to insert a line break in a SQL Server VARCHAR/NVARCHAR string

There are some scenarios where we need to put line breaks in the string we write back from procedure or any dynamic SQL we use.

Here is how we can do this by adding CHAR(13) or CHAR(10) in between the string we write back. This will insert carriage return(code 13) or newline feed(code 10) in the text leading to the text format as you are trying to get.

SET @ReturnMsg = 'Missing state information.' + CHAR(13) + 'This is Address line 1.'
SELECT @ReturnMsg

Monday, March 10, 2014

How to access a div or HTML controls is inside a gridview?

Here is an example of how to access a div inside the TemplateColumn of a Grid:


<asp:TemplateField HeaderText="Pick" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
<ItemStyle Width="60px" />
<div id="divpickstatus" runat="server">


protected void gridview_schedule_RowDataBound(object sender, GridViewRowEventArgs e)
if (e.Row.RowType == DataControlRowType.DataRow)
HtmlGenericControl divpickstatus = (HtmlGenericControl)e.Row.FindControl("divpickstatus");
Hope this helps.

Saturday, March 08, 2014

Create Windows admin user from command line

Here is how we can create windows user from command prompt.
c:\net user /add [username] [password]
The above will creates the user account.

To add the user account to administrators group. Need to do like this below
c:\net localgroup administrators [username] /add

Hope this helps!

Guide to Resetting a Windows 7 Password

Every one has tendency to forget passwords. I am one of them. Here is the nice tutorial to reset windows 7 password which helped me. Its very helpful and nice tutorial. Author has done very good job for compiling this.

Hope this helps to you as well.