|
try
onClick="return confirm('Ready to submit');"
or in ASP.Net
onClientClick="return confirm('Ready to submit');"
the return value influences the submit process: false stopps the submit
if that works write a java script function (ex. Check), wich checks the textbox for empty and returns false if so and tie it to the onClientClick-event
onClientClick="return check();"
|
|
|
|
|
hi
help me and tell me how to use postback url in .net2005?plz give an example
|
|
|
|
|
First I must ask do you really want to Post your page to a different page. There are good reason to do this, but in most cases it probably makes more sense to just have the button postback to your code behind for the page you are on.
If you do have a good reason to post to a different page, all you have to do is set the postbackurl on the control that you are using. In the page load of the other page you can check for PreviousPage. If that is not Null (Nothing in VB) then you have postbackurl from one page to a different page.
Hope that helps.
Ben
|
|
|
|
|
suppose i have 2 usercontrol called usercontrol1 and usercontrol2.
i want to call a method of usercontrol2 from usercontrol1.is it possible ??
if yes then pls tell me how could i do this with sample code in detail.
tbhattacharjee
|
|
|
|
|
I think a usercontrol should be working totally independent (as per OOAD principles). However if you still want to do that you can raise event from usercontrol1 that gets handled in ASPx Page which will call the method from usercontrol2. I hope this helps.
Shirish.
|
|
|
|
|
Hi
Sometimes while adding javascript code or any code in the codebehind,the event handler written in InitializeComponent() method vanishes off.
I have experienced it many times in my application.
What can be the reason for this and how can we avoid this?
Thanks
~VSree
|
|
|
|
|
I also faced these kinda problems. May be this is the bug of VS.
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
Is there any way to avoid this problem at least to a certain extent?
Because, it creates severe effects to the application, making the application an idle one!
|
|
|
|
|
In my application i have two textboxes and a save button. ON clicking Save button on client side i want to check that the textboxes are not empty and display the appropriate message on the label controls.
thanks in advance.
|
|
|
|
|
Use RequiredFieldValidator.
Add a RequiredFieldValidator and set the property ControlTovalidate as your textboxname , set the appropriate error message on ErrorMessage property
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
no i cannot use requiredfieldvalidator . I want to have clint side interaction;requiredfieldvalidator works on
server side .Something in javascripting ?????????
|
|
|
|
|
No buddy. It works in client side.
Anyway the javascript code for mandatory text field is here
function RequiredField()
{
document.getElementById("lblErrormessage").innerText = '';
if(document.getElementById("TextBox1").value == '')
{
document.getElementById("lblErrormessage").innerText = "Field is required";
return false;
}
return true;
}
add this method in Page_Load event code bahind on some submit button onclick like
button1.Attributes.Add("onclick","return RequiredField()");
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
|
Of course, "Textbox1" won't work, as the framework assigns it's own Id, based on where the control is in the page heirarchy. You're definately better off using the validators, which do indeed work on the client.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
no i have a problem here . i have two textboxes .The problem is with this .
At a time only one label gives text the other is not. i cant understand this .
function checknews()
{
var reqheadline,reqnewsdetail;
reqheadline=document.getElementById("TextBox1").innerText;
reqnewsdetail=document.getElementById("TextBox2").innerText ;
alert(reqnewsdetail);
if(reqheadline=="")
{
document.getElementById("label5").innerText = "Enter Headline" ;
return false;
}
if(reqnewsdetail=="")
{ alert("bhavna");
document.getElementById("label6").innerText = "Enter News Details" ;
return false ;
}
return true;
}
|
|
|
|
|
change like this. if it works give score for me
if(reqheadline=="")
document.getElementById("label5").innerText = "Enter Headline" ;
if(reqnewsdetail=="")
document.getElementById("label6").innerText = "Enter News Details" ;
if(reqheadline=="" || reqnewsdetail=="")
return false ;
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
no its not working .
return true does not work now.
|
|
|
|
|
add
return true;
in the end. Why are you not thinking simple logiv I dont know
Anyway all the best
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
not working
var reqheadline,reqnewsdetail;
reqheadline=document.getElementById("TextBox1").innerText;
reqnewsdetail=document.getElementById("TextBox2").innerText ;
if(reqheadline=="")
document.getElementById("label5").innerText = "Enter Headline" ;
if(reqnewsdetail=="")
document.getElementById("label6").innerText = "Enter News Details" ;
if(reqheadline=="" || reqnewsdetail=="")
return false ;
return true;
}
|
|
|
|
|
what is the error you are getting?
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
when i fill up now the textboxes it is not getting submitted.
|
|
|
|
|
why are you changing your code yourself.
see my code for text box as
if(document.getElementById("TextBox1").value == '')
but you changed as innerText.
for textbox its value
for label its innerText
ok
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
sorry for giving you the trouble.
now its working .
thanks
|
|
|
|
|
You have to sharpen your Javascript knowledge.
Read this link which is from w3cschools.this will help you alot
http://www.w3schools.com/js/default.asp[^]
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
sylvester_g_m@yahoo.com
|
|
|
|
|
You can either use javascript or requiredfield validatior for this
|
|
|
|