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:

aspx:

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



codebehind



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.

Wednesday, February 12, 2014

Delete a table data using JOINS in SQL Server

Here is how we can delete using JOINS. I have used inner join here.

DELETE
Table1
FROM
Table1 INNER JOIN Table2
ON Table1.Field2 = Table2.Field2
WHERE -- YOUR WHERE CONDITIONS
Table2.Field3 IS NOT NULL


Hope this helps

Update a table using JOINS in SQL Server

Here is how we can update a table using JOINS in SQL SERVER.

UPDATE
Table1
SET
Table1.Field1 = Table2.Field1
FROM
Table1
INNER JOIN Table2 ON Table1.Field2 = Table2.Field2
WHERE -- YOUR WHERE CONDITIONS
Table2.Field3 IS NOT NULL


Hope this helps