Click here to Skip to main content
15,892,005 members

N!dh!sh - Professional Profile



Summary

    Blog RSS
198
Authority
7
Debator
63
Editor
15
Enquirer
17
Organiser
400
Participant
0
Author
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Reputation

Weekly Data. Recent events may not appear immediately. For information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

Actions with a green tick can be performed by this member.


 
GeneralExport Pin
N!dh!sh13-Nov-12 6:48
N!dh!sh13-Nov-12 6:48 
GeneralGridview Pin
N!dh!sh10-Oct-11 4:57
N!dh!sh10-Oct-11 4:57 
GeneralCode Tips 3 [modified] Pin
N!dh!sh12-Aug-11 3:47
N!dh!sh12-Aug-11 3:47 
1)To close browser window without confirmation
2)Clear page cache
3)To set values in textbox txtPassword after a postback, include below code in page load
4)To include SessionState
5)To disable 'Enter' press in a web page (except multiline textboxes)
6)Javascript to find out which control has the focus
7)To maximise the window size
8)Using Submit().
9)Delay using javascript
10)Disable right click and ctrl+A
11)Replace \ with \\
12)To get folder names in a folder
--------------------------------------------------------------------------------------------------
1)To close browser window without confirmation
In .aspx.cs page,
MessageBox.Show("Already expired");
Page.ClientScript.RegisterStartupScript(this.GetType(), "closePage", "javascript: funClose();", true);

In .aspx page,

function funClose()
{
window.opener = 'Self';
window.open('','_parent','');
window.close();
}


OR
In .aspx.cs page,
string script = "window.opener = 'Self';window.open('','_parent',''); window.close();";
Page.ClientScript.RegisterStartupScript(this.GetType(), "Close Window", script, true);
--------------------------------------------------------------------------------------------------
2)Clear page cache

Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
//will not save the file to temp internet files
Response.Cache.SetNoStore();
//will not save the request or the response to and from the server anywhere
Response.Cache.SetNoServerCaching();
--------------------------------------------------------------------------------------------------
3)To set values in textbox txtPassword after a postback, include below code in page load
txtPassword.Attributes.Add("Value", txtPassword.Text.Trim());
--------------------------------------------------------------------------------------------------
4) To include SessionState

<system.web>
<sessionState mode="InProc" timeout="20"/>
</system.web>
--------------------------------------------------------------------------------------------------
5)To disable 'Enter' press in a web page (except multiline textboxes)

function BlockEnterPress(e)
{
var id=window.status=event.srcElement.id;
if(id=="txtCurrentAddress" || id=="txtPermanentAddress") //multiline textboxes
return true;
else
{
var key;
if(window.event)
key=window.event.keyCode;
else
key=e.which;
return (key!=13);
}
}

<body onkeydown="return BlockEnterPress(event)">
--------------------------------------------------------------------------------------------------
6)Javascript to find out which control has the focus

var id=window.status=event.srcElement.id;
--------------------------------------------------------------------------------------------------
7)To maximise the window size

window.moveTo(0,0);
window.resizeTo(screen.availWidth, screen.availHeight);
--------------------------------------------------------------------------------------------------
8)Using Submit()

Step 1:
Code in .aspx page (let function is called from a gridview column),

<asp:TemplateField ItemStyle- HeaderText="Example">

<ItemTemplate>
<a href="#" onclick='<%# " return submitfrm("+ (DataBinder.Eval(Container.DataItem,"SolutionID")) + "," + Proj.Utils.ControlChars.Quote + "ViewSolution.aspx" + Proj.Utils.ControlChars.Quote + "," + Proj.Utils.ControlChars.Quote + "POST" + Proj.Utils.ControlChars.Quote + ");" %>'>
<%#Eval("Problem") %></a>
</ItemTemplate>
</asp:TemplateField>

Step 2:
Include submitfrm() and a form in master page,

function submitfrm(itemId, UrlPath, actionMode)
{
document.forms[1].hfItemId.value = itemId;
document.forms[1].action = UrlPath;
document.forms[1].method = actionMode;
document.forms[1].submit();
}

<form name="frm2" id="frm2" method="post">
<input type="hidden" name="hfItemId" id="hfItemId" value="" />
<input type="hidden" name="hidMode" id="hidMode" value="" />
</form>

Step 3:
Include below code in .aspx.cs page in which query string is to be used

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
ViewState["ID"] = Convert.ToString(Request.Form["hfItemId"]);

}
}
-------------------------------------------------------------------------------------------------
9)Delay using javascript

function Func1Delay()
{
// alert('Will wait for one second');
wait(3000);
alert('Finished waiting');
}
function wait(msecs)
{
var start = new Date().getTime();
var cur = start
while(cur - start < msecs)
{
cur = new Date().getTime();
}
}
-----------------------------------------------------------------------------------
10)Disable right click and ctrl+A

<script language="JavaScript" type="text/javascript">

function disableselect(e) {
return false
}
function reEnable() {
return true
}
document.onselectstart = new Function("return false")
document.oncontextmenu = new Function("return false")
if (window.sidebar) {
document.onmousedown = disableselect
document.onclick = reEnable
}
</script>

------------------------------------------------------------------------------------
11)Replace \ with \\
string new = old.Replace(@"\", @"\\");

------------------------------------------------------------------------------------
12)To get folder names in a folder
string[] strFoldersWithPath;
string[] strFolderDetails;

strFoldersWithPath = Directory.GetDirectories(Server.MapPath("~\\images\\"));
string[] strFolderName = new string[strFoldersWithPath.Count()];
for (int i = 0; i < strFoldersWithPath.Count(); i++)
{
strFolderDetails = strFoldersWithPath[i].Split(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
strFolderName[i] = strFolderDetails[strFolderDetails.Length - 1];
}
--------------------------------------------------------------------------------------

modified on Monday, September 19, 2011 8:36 AM


modified 13-Oct-12 15:08pm.

GeneralCodeTips 2 [modified] Pin
N!dh!sh4-Jul-11 0:53
N!dh!sh4-Jul-11 0:53 
GeneralResize uploaded image [modified] Pin
N!dh!sh1-Jul-11 0:40
N!dh!sh1-Jul-11 0:40 
GeneralUseful Links [modified] Pin
N!dh!sh30-May-11 21:19
N!dh!sh30-May-11 21:19 
GeneralCode Tips [modified] Pin
N!dh!sh29-May-11 21:23
N!dh!sh29-May-11 21:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.