|
Hi,
i am not able set the args.isValid as false for JS function...which is not having custom validator..
find the code below:
<asp:LinkButton runat="server" ID="btnApply" TabIndex="1" CssClass=" primary" OnClientClick = "return ApplyClick(this);" >
JS Code:
function Applyclick(args) {
if (errMsg != null) {
args.IsValid = false;
}
return false;
}
thanks in advance
modified 2-Feb-12 5:03am.
|
|
|
|
|
I am sorry I dont know asp.net but yet
what is args and who is calling ApplyPromotionClick ???
I know I am coward since the day I know that fortune favors the brave
|
|
|
|
|
Sorry function name should be applyclick
|
|
|
|
|
In that case Check your Firefox or Chrome error message. I cant recall any html object property IsValid. I think you need to say more clearly what you need
I know I am coward since the day I know that fortune favors the brave
|
|
|
|
|
Hello everyone, I would like to know if you can help me out in a simply task yet I cant get my way around it.
Ive manage to update a single DIV but cant update a php file with several different DIV.
Data is comming from a mysql query using a separate php file.
This is what ive got, please can you help me write a simple code to recover more than one piece of data from a mysql query and update all the divs of an html,php file?
<pre lang="Javascript"> <
html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
setInterval(get,1000);
function get() {
$.post('data.php', {
},
function(output){
var datosobtenidos = $('#age').html(output);
document.getElementById('diesel').innerHTML = datosobtenidos; //"ADIOS";
});
}
</script>
</head>
<body>
<h2>JavaScript Auto Refresh Page</h2>
<p>This code will refresh you page in 6 seconds. We have used OnLoad() Event function to call our function.
Note : Please don’t use a lot of auto refresh page because it is kind of annoying and your sever bandwidth will be decreasing, one way you are increasing hits to server.
<p>
<div id="age"></div>
<br />
<br />
<div id="diesel"></div>
</p>
</body>
</html
>
|
|
|
|
|
Call your page twice with two different parameter.
1. age
2. diesel
when age would reply then update the age div
when diesel would reply then update the diesel div
|
|
|
|
|
Guys; I called the function RequestTheServer() in client-side, but no request reatched the server.
But when I replaced the data property ctl00$ContentPlaceHolder1$txtValue in function GetData() to txtValue_text every gone OK.
Please see the code below:
function RequestTheServer() {
$.ajax({
type: "POST",
url: '/Default.aspx',
data: GetData(),
});
}
function GetData() {
var data = {
__EVENTTARGET: '__Page',
__EVENTARGUMENT: 'LRep',
ctl00$ContentPlaceHolder1$txtValue: $get('ctl00_ContentPlaceHolder1_txtValue').value
};
return data;
}
I am wondering why this happened with me since it doesn't look logical.
Help people,so poeple can help you.
|
|
|
|
|
In the posted AJAX request the data will be sent as name value pairs. To make any sense of the parameters one must know which parameter is which and this is usually done by giving a name to this parameter. You have three parameters here and the first two are called __EVENTTARGET and __EVENTARGUMENT. I guess in your Default.aspx these parameters are evaluated to figure out what is to be done. The name of your third parameter was given in a way that suggests it is some kind of client side ID the way it is rendered by ASP.NET, but in order for your code to figure which parameter to retrieve you would never use the client side ID for the parameters name as this ID is allowed to change and can thus not be used to identify a parameter when it is processed at the server side.
From what you've told us one can only assume that when your server side code (Default.aspx) retrieves the third parameter it tries to fetch it by its name and that name must be txtValue_text.
Regards,
Manfred
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
Sir;
Consider the code in Using JQuery ajax with UpdatePanels[^].
I use __EVENTTARGET and __EVENTARGUMENT to cause a regular postback which i can catch with IPostBackEventHandler.RaisePostBackEvent() .
now consider a textbox with id of "txtValue" used to get a value from the user to be used to evaluate other data list. this textbox would be rendered as
<input type="text" id='<%= txtValue.ClientID %>' name='<%= txtValue.UniqueID %>' /> and when a form containing the text box is submitted .NET puts the request value of Request.Form(txtValue.UniqueID) in the property txtValue.Text.
So, I am trying to put txtValue.UniqueID in the request data to use txtValue.Text regularly.
Help people,so poeple can help you.
|
|
|
|
|
The point of using an UpdatePanel is to produce asynchronous partial page updates. JQuery AJAX is also used for asynchronous processing and can be used to update the page. I don't see the point of trying to use them both. You could just trigger the UpdatePanel.
No comment
|
|
|
|
|
Sir Mark Nischalake;
Sometimes we face problems so we should use alternative ways to solve them. I know that UpdatePanel s and asynchronous post-backs are the opposite of JQuery ajax, but sometimes we should use them together
To clarify the idea please consider this article Asynchronous File Upload[^]
No Comment either, not even a Like
Help people,so poeple can help you.
|
|
|
|
|
Ali Al Omairi(Abu AlHassan) wrote: asynchronous post-backs are the opposite of JQuery ajax
I think you have a misunderstanding about both processes and their usages. They are not opposites. IMO, you are on a fools errand, but you seem well qualified for it.
No comment
|
|
|
|
|
Well ...,
ctl00$ContentPlaceHolder1$txtValue in a name of an existing TextBox in the Page ,so this request will cause an exception of type ArgumentException in the function ClientScriptManager.ValidateEvent() ( the stack trace below )
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +173
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +69
System.Web.UI.WebControls.TextBox.LoadPostData(String postDataKey, NameValueCollection postCollection) +34
System.Web.UI.WebControls.TextBox.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) +14
System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +343
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
We can avoid that by setting the property Page.EnableEventValidation to false.
Help people,so poeple can help you.
|
|
|
|
|
Ali Al Omairi(Abu AlHassan) wrote: We can avoid that by setting...
Yes, and you can avoid having money by posting your bank account numbers online.
EnableEventValidation is there for a reason. Just because you can do something doesn't mean it is the correct choice.
No comment
|
|
|
|
|
Good Day
i have a shared function as called in vb.net or static function in C# that is declared like this
Public Shared Function runjQueryCode(ByVal jsCodetoRun As String, ByVal Page As Page)
Dim requestSM As ScriptManager = ScriptManager.GetCurrent(Page)
If requestSM IsNot Nothing AndAlso requestSM.IsInAsyncPostBack Then
ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), Guid.NewGuid().ToString(), getjQueryCode(jsCodetoRun), True)
Else
Page.ClientScript.RegisterClientScriptBlock(GetType(Page), Guid.NewGuid().ToString(), getjQueryCode(jsCodetoRun), True)
End If
End Function
now the function is running the jquery from the server side, this works well now i want to call this function from the client side inside a nested table in a listview like this
<td>
<div id="Div2" runat="server" %>'
<a href="#" onclick='<%# clsFunctions.runjQueryCode("$('#basic-modal-ontent').modal()", this) %>'></a>
<img src="../../Imgs/Linkquestionare.png" border="0"/></a></div>
</td>
Now i have two Questions. the first one is my function accept the JQuery string and the reference to the page. Well i can do this on the server side and i am able to do this nicely , but i want to do it on the client side
The following is content that i want to pass to the function as the first argument. /
"$('#basic-modal-ontent').modal()"
and as you can see, i tried to pass "this" trying to get the reference to the page.
1) in would like to pass that string in the function as my first argument
2) i want to pass the page reference to the function as my second parameter.
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
I think you don't need to call ScriptManager.RegisterClientScriptBlock() or ClientScripManagert.RegisterClientScriptBlock instead you return getjQueryCode(jsCodetoRun) .
this will bind the script in on click event of the HTMLAnchor (<a> ... </a>)
Help people,so poeple can help you.
|
|
|
|
|
the function already does that.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Hi
I have two posts: /post1, /post2
how I can create a link that every 20 seconds redirect to one of them. I mean if this link go to /post1, after 20 seconds if that or another person click on it go to /post2
please help me
thanks
|
|
|
|
|
|
Ok I'm trying to figure out how to loop through the values of my table cells (they all have a image in them). When I created the cells I named them with a id="A2" (for example).
the code I've been trying in testing looks like this:
savedSquares = document.getElementById('A2');
alert("a2 = " + savedSquares);
alert(document.getElementById("innerSquares").rows[0].cells.length);
address = document.getElementById("innerSquares").rows[0].cells[3].value;
alert("cell = " + address);
The results in order are
A2 = [object HTMLTableCellElement]
10 (this is correct)
cell = undefined
I've tried a bunch of other combos but this is what I currently have.
The images are also named the same so the image in "A2" is also named the same way:
<img src="images/o.jpg" border="0" height="100" width="100" name="A2" alt="Open">
Not sure if that will make it easier but I haven't been able to read those with my limited knowledge of JavaScript. The looping through part won't be a issue, I just need to figure out how to get the name of the image or even the alt text would be doable.
Thanks in advance!!
|
|
|
|
|
Ok so I made some progress... if I use
savedSquares = document.images['A2'].alt;
it retreives the alt value which is a step in the right direction. Just wondering if there is a better way?
|
|
|
|
|
It's not very clear to me what you are trying to do. Table cells don't have values, they are just container elements.
If you have a table cell, you can loop through its contents using cell.childNodes (where 'cell' is your cell element). Or you could get a list of all the images contained in the cell with cell.getElementsByTagName('img') .
W3schools has a decent reference and tutorial: http://www.w3schools.com/jsref/dom_obj_all.asp[^]
|
|
|
|
|
hai all
i want to browse the folder or image in javascript...i saw a code in html like instead of this...i want in javascript...is it possible...
Thanks & Regards
D.Sathyanarayanan
|
|
|
|
|
Start here[^].
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Goood response... Thumbs Up...
|
|
|
|