Posts

How to Do a Remote Shutdown for a PC on a LAN

Image
Steps 1 Open the command prompt.  This may be done by clicking on the "Start" button, and selecting "Run". Ad 2 Type in  cmd  and press Enter. 3 Type in  shutdown -m \\computername , replacing "computername" with the name of the computer you wish to shutdown or the computer's IP address. 4 Experiment with the shutdown command's switches. -r  will force a restart, disabling any services or user interaction from interrupting it. -c  "comment" will force a comment to appear on the system being shutdown. -t xx  will force a timeout for "xx" seconds. For example,  -t 60  would perform a shutdown after a 60-second timeout. -a  will abort the shutdown. A full command example:  shutdown -m \\myserver -r -c "This system will shutdown in 60 seconds" -t 60 5 Try another method: Type  shutdown -i  in the run window. Click the "Add" box and type the name of the computer ...

Finding duplicate values in a SQL table

SELECT * FROM ( SELECT Id , Name , Age , Comments , Row_Number () OVER ( PARTITION BY Name , Age ORDER By Name ) As Rank FROM Customers ) AS B WHERE Rank > 1

How do I find the Client ID of control within an ASP.NET GridView?

<asp:TemplateField> <ItemTemplate> <asp:TextBox ID = "textDateSent" runat = "server" > </asp:TextBox> <input type="button" value='Today' onclick="setToday(' <% # ((GridViewRow)Container).FindControl("textDateSent").ClientID %>');" /> </ItemTemplate> </asp:TemplateField>

How to make eachcontrol inside update panel to readonly.

private static void DisableControl(System.Web.UI.Control control)         {             System.Reflection.PropertyInfo enProp = control.GetType().GetProperty("Enabled");             if (enProp != null)             {                 enProp.SetValue(control, false, null);             }             foreach (System.Web.UI.Control ctrl in control.Controls)             {                 DisableControl(ctrl);             }  ...

Delete gridview row inside repeater by javascript onclient click in asp.net

//Add this in c# code to add client event in button then write your delete code on repeater itemcommand protected void GrdImageDetail_RowDataBound(object sender, GridViewRowEventArgs e)         {             if (e.Row.RowType == DataControlRowType.DataRow)             {                 (e.Row.FindControl("lnkDelete") as LinkButton).OnClientClick = "return DeletegrdIndustrySplFiles('" + (rptAccordian.Items[e.Row.RowIndex].FindControl("GrdImageDetail")).ClientID + "','" + e.Row.RowIndex.ToString() + "');";             }         } //javascript to delete row from client side  function DeletegrdIndustrySplFiles(gridclientid, rowindex) {       ...

How to find main aspx page hidden control in child user control in c#

 (this.Parent.NamingContainer.FindControl("hfIsNeedToRebind") as HiddenField).Value

Get control name in Page_Load event after post back by any control

Add script -------------------- function __doPostBack(eventTarget, eventArgument)  { if  (!theForm.onsubmit || (theForm.onsubmit() ! =   false )) { theForm.__EVENTTARGET.value  =  eventTarget; theForm.__EVENTARGUMENT.value  =  eventArgument; theForm.submit();  }  } ---------------------- <input type= "hidden"  name= "__EVENTTARGET"  id= "__EVENTTARGET"  value= ""  /> <input type= "hidden"  name= "__EVENTARGUMENT"  id= "__EVENTARGUMENT"  value= ""  /> <select name="DropDownList1" onchange="javascript:setTimeout('__doPostBack(\'DropDownList1\',\'\')', 0)" id="DropDownList1">             <option value="1">abc</option>             <option value="2">xyz</option> </select> --------------------- private string getPostBackControlName() ...