|
andyk1967 wrote: My guess is that I just miss a tiny bit...
What you miss is the control life cycle, or more exactly the order of the events. You bind the datasource to the ListBox in the Page_Load event, and update the data base in the button Click event, and basically the Page_Load happens before the postback event such as the button's Click event. So the list does not reflect the updated data until you click the button again or call redirect in order for the data binding code to re-run. Here, in the buton click event handler, after you update database you simply run the code to bind the datasource to the LixtBox again to refresh the control.
|
|
|
|
|
Hi all,
Can any body tell me how to restrict the user without seeing source code of the page by right clicking the mouse on the page and select view source or from view menu of the menu bar. Thanks in advance.
Thanks and Regards
Venkat
|
|
|
|
|
add some javascript:
<br />
page.onmenu = "javascript: return false;"<br />
(BTW - removed in the above replaced "onmenu" that I typed)
should prevent the cm functioning at all. As for disabling particular items, doubt it's possible - Guffa? Ista? Anyone hehe?
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
-- modified at 9:15 Tuesday 4th July, 2006
|
|
|
|
|
Thanks man. But can you explain me where i should this code Thanks in advance.
Thanks and Regards
Venkat
|
|
|
|
|
The short answer is: you can't.
Richard's trick is a good one, and will overwrite the default context menu that appears from a right-click on the page. However, the browser is considered to be owned exclusively by the user, not the page. As a result, no code on a page can interfere with the core functions of the browser. The "View-->Source" option of the browser's main menu bar will always be present. Also, a user can simply disable javascript (or use an add-on) to use the default context menu despite any scripting that you do to hide it.
At the end of the day, anything that you render to the browser can be viewed as source and there is nothing that you can do to prevent it. As a rule of thumb, I'd strongly recommend that you render nothing to the browser that you do not wish the general public to see.
--Jesse
|
|
|
|
|
"web server on this computer is not running"
iam getting error message while opening an webapp
plz let me know
plz let me know asap
with regards
d.ravi kiran reddy
|
|
|
|
|
Have you tried starting the web server?
|
|
|
|
|
But seriously. Is there a web server installed on your machine?
To check if IIS is there, click start > run > type inetmgr and hit enter. This should open up IIS admin page if it exists.
|
|
|
|
|
iam able to see the adminpage but iam not able to find the files which have been prevly there
with regards
d.ravi kiran reddy
|
|
|
|
|
hai,
still iam getting the same error message
plz let me know asap
|
|
|
|
|
Man, try adding a new virtual directory within IIS and pointing it at your website files, or possibly re-installing the app if you're still getting issues.
|
|
|
|
|
Hi all,
Im using C# as my code behind, im having a code in the button click event where im checking whether a file is exists, if it exists then it show the confirmation message box like "file found, want to continue", but its happening if we register the script in the page load and its not checking the condition. By clciking the button itself its showing the message box.
i need that script should get pop up only after the condition get satisfied. Is it possible? Please help me out to solve this problem. Thanks a lot in advance.
The code is given below
private void Page_Load(object sender, System.EventArgs e)
{
i = "file Exists";
StringBuilder str = new StringBuilder();
str.Append("");
str.Append("function PopWindow()");
str.Append("{");
str.Append("alert('hello world')");
str.Append("}");
str.Append("");
if(!Page.IsClientScriptBlockRegistered("clientscript"))
{
Page.RegisterStartupScript("clientscript",str.ToString());
}
Button1.Attributes.Add("onclick","PopWindow();");
}
private void Button1_Click(object sender, System.EventArgs e)
{
if (i=="file Exists")
{
int x= 0;
int y =0;
x = x+ y;
Button1.Attributes.Add("onclick","PopWindow();");
int a = 2;
int z = 2;
z = z+ a;
Response.Write(z.ToString());
}
}
Regards
Mukilan.
REgards
Mukilan
|
|
|
|
|
Well the problem is that client side code always get executed before the page is sent to the server.
So if your button has a server-side event and also a client side one (Button1.Attributes.Add("onclick","PopWindow();"); ) the PopWindow() will get called when you press the button and after that the page will be send to the server.
What you need to do is register the client script to be shown after the page has been submitted. So do not add an onclick attribute to the button, but in the Button1_Click(object sender, System.EventArgs e) method after validating if you need to show a popup just use Page.RegisterClientScriptBlock("msg","PopWindow();); . This will cause the PopWindow javascript method to be called after the page loads on the clients side.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
thank u very much for your suggestion
but if i register code after checking the condition, that message box is not getting pop upped, in the browser if we click button, the "popwindow()" string is getting displayed
Code is given below,
private void Button1_Click(object sender, System.EventArgs e)
{
if (i=="file Exists")
{
int x= 0;
int y =0;
x = x+ y;
StringBuilder str = new StringBuilder();
str.Append("");
str.Append("function PopWindow()");
str.Append("{");
str.Append("alert('hello world')");
str.Append("}");
str.Append(""); Page.RegisterClientScriptBlock("clientscript","PopWindow();");// Here is the problem
Another Way
Page.RegisterClientScriptBlock("clientscript",PopWindow()); // its giving build error as follows(without specified in the quotes)
c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.cs(79): The name 'PopWindow' does not exist in the class or namespace 'WebApplication1.WebForm1'
int a = 2;
int z = 2;
z = z+ a;
}
}
Mukil
|
|
|
|
|
Why are you dynamically creating the PopWindow function. Surely if it's static you can just include it in the head of the page?
|
|
|
|
|
psmukil wrote: StringBuilder str = new StringBuilder();
str.Append("");
str.Append("function PopWindow()");
str.Append("{");
str.Append("alert('hello world')");
str.Append("}");
str.Append(""); Page.RegisterClientScriptBlock("clientscript","PopWindow();");// Here is the problem
You are only putting the code for the function in the StringBuilder, you don't use it for anything.
The StringBuilder doesn't automatically recognise that you have created a script, and that there is a web page where the script could go. Neither does the RegisterClientScriptBlock automatically recognise that you happen to have a StringBuilder that contains a script with a function that corresponds with the function call in the code that you do add to the page.
---
b { font-weight: normal; }
-- modified at 8:28 Tuesday 4th July, 2006
|
|
|
|
|
The problem is that you don't have any function called PopWindow() in your rendered page. Why? Because you didn't place it there. You have just defined the StringBuilder in you method, but didn't send it to the page.
1. Put the Javascript in a .js file and inlcude a link to it from HTML
or
2. Register the javascript in the page on page_load just as you do the function call.
regards,
Mircea
Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.
|
|
|
|
|
google can't search my image in my web site
how can i solve it ?
With Thanks
MHF
|
|
|
|
|
I create DataTable in code C# as Add-method of DataRow. Then I do DataGrid.DataSource = DataTable and DataGrid.DataBind.
Can I set BackColor for DataRow at moment of work Add-method? It is impossible to set BackColor for object DataGridItem in DataGrid in my situation.
michailk2001
|
|
|
|
|
|
I have done windows authentication customization in my project which works on the intranet site , but not on internet site. how can i know that a site is internet or intranet at the customer side. i can't access their site, i just want to know whether it is internet or intranet site.
SatyajitV .Net developer
|
|
|
|
|
Hi!
I have a password fields in a Login form. Now I try to encode it then so decode it again. Please help me!
Thanks!
|
|
|
|
|
What is it that you need help with?
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
.NEt provides algorithms for encryption and decryption in namespace System.Security.Cryptography
Check it,
Thanks
Sushant Duggal.
|
|
|
|
|
Pls , can anybody give me some information related to conversion of xml document to word document using asp.net.
Balasaheb
Software Developer
Platform: Asp.net,vb.net
Database: SQL Server 2000
|
|
|
|