|
You can use AJAX to execute a server side function
|
|
|
|
|
hi navaneeth how ru ... this is id by writting the code in server button click .and i called the button click in javascript like this
var obj
obj=document.getElementById("btngetdata");
obj.click();
still its not getting is any other with out using ajax
|
|
|
|
|
I have created one library which will help to call button event when enter key is pressed. Check this[^] and download the library
|
|
|
|
|
DefaultButton.SetDefaultButton ( control , btButton )
where i should write this one
|
|
|
|
|
You can write in page load.
|
|
|
|
|
txtBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode){if ((event.which == 13) || (event.keyCode == 13)) {document.getElementById('"+Button1.UniqueID+"').click();return false;}} else {return true}; ");
this is working sir thanks u sir
|
|
|
|
|
jagadeeshkumar2106 wrote: how can i call code behind function through java script function (help plz)
maybe. you can use ajax.
function fireFunc() {<br />
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;<br />
if (keyCode == 13) {<br />
<br />
var req = false;<br />
<br />
if (window.XMLHttpRequest) {<br />
req = new XMLHttpRequest();<br />
}<br />
else if (window.ActiveXObject) {<br />
req = new ActiveXObject("Microsoft.XMLHTTP");<br />
}<br />
req.open('POST', "http://urdomain.com/urpage/aspx", true);<br />
req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');<br />
req.onreadystatechange = function() {<br />
if (req.readyState == 4) {<br />
}<br />
}<br />
req.send("querystring");<br />
<br />
}<br />
}<br />
<br />
<br />
<input type="text" value="Check Answer" onkeypress="fireFunc()" >
|
|
|
|
|
You will have to put your function/procedure in a page and this page needs to be called as specified by Michael Sync. You can send any value to it using the querystring.
Nav
|
|
|
|
|
i want the code to run a procudere when enter key is pressed in asp.net apllication .the key event should happen when i press the enter key in textbox.
|
|
|
|
|
Use Javascript function and call it on the server side.
TextBox1.Attributes.Add("onkeypress","CheckKeyCode();")
Validate the key as:
function CheckKeyCode()
{
if(event.keyCode == 13)
{
return true;
}
else
{
return false;
}
}
God is always with you.
|
|
|
|
|
jagadeeshkumar2106 wrote: i want the code to run a procudere
this procedure is written in Javascript? if yes, chk the example below..
Example.
function fireFunc() {<br />
var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;<br />
if (keyCode == 13) {<br />
yourprocedure();<br />
}<br />
}<br />
<br />
<br />
<input type="text" value="Check Answer" onkeypress="fireFunc()" >
|
|
|
|
|
sorry. i didn't see Saranya Devi's post.
|
|
|
|
|
sir the procedure is in code behind and it should call in javascript
|
|
|
|
|
Call your procedure like this:
function getProcedure()
{
var obj
obj=document.getElementById("button2")
button2.click();
}
"severside_handler" is the codebehind function that hander the button's
server click event.
God is always with you.
|
|
|
|
|
var obj
obj=document.getElementById("btngetdata");
obj.click();
i wrote like this and i kept two alerts before and after .but iam getting the two messages in the alert but iam not getting the this obj.click.
|
|
|
|
|
Try btngetdata.click();
God is always with you.
|
|
|
|
|
i posted the answer in your new post..
|
|
|
|
|
Hi i am getting error as:
"Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index "
In this error occur in user control...,
In that control i have repeater control...,
In that i bind some datas from my table...,
In my main tab...,
First one contained 4 subtabs and second one contained 2 subtabs...,
Suppose if i select first main tab from that 5th subtab then if i select second main tab...,
It will show this error, becoz second one have only 2 subtabs...,
The pointer will refer the 4th tab in 2nd main tab...,
So,its out of range...,
How to show default the first subtab whenever select another maintab?,
This is my code:
Public Sub SelectSubTab(ByVal index As Integer)
If ((index < 0) _
OrElse (index > SubTabText.Count)) Then
index = 0
End If
ViewState("CurrentSubTabIndex") = index
BindData()
Dim ev As SelectionChangedEventArgs = New SelectionChangedEventArgs
ev.TabPosition = CType(ViewState("CurrentTabIndex"), Integer)
ev.SubTabPosition = index
RaiseEvent SelectionChanged(Me, ev)
End Sub
Help me...,
Regards,
Mageshh
|
|
|
|
|
I think you need to change condition
OrElse (index > SubTabText.Count)) Then
use
OrElse (index >= SubTabText.Count)) Then
Nav
|
|
|
|
|
Try
index > SubTabText.Count - 1
Regards,
Riza Azmi
Simple thing should be simple, complex thing should be possible
|
|
|
|
|
No its not working...,
If its with out this statement:
ViewState("CurrentSubTabIndex") = index
Then it will work...,
But using this above statement i am doing some other functions...,
So that statement must...,
So plz tell me some other solution...,
Regards,
Mageshh
|
|
|
|
|
Hi,
My website is in ASP.NET 2005 and C#. I am facing a problem in TreeView control's SelectedNodeChanged event. due to some unknown reason this event is not firing for all nodes, sometimes it works ok for a node but some times it dosnt work at all! i added nodes at design time and assigned them the URL's. Kindly tell me what is the reason of this problem? Do i have to set some property?
Regards,
Affan Ahmad Toor
..................
QUAIDIAN FOR ONCE, QUAIDIAN FOR EVER!
|
|
|
|
|
following is the expression
[-+]?[0-9]*\.?[0-9]*
i am using to validate for the given examples.
12
12.34
23.456
0.5
0.0
0
The validation string is working fine , if i use the vaidation control.But fails in case , i use it in the source file and using the regexp
there in the source file , the code is
var reg = new RegExp("[-+]?[0-9]*\.?[0-9]*");
reg.test(txt1.value)
txt1 is the textbox .i am getting the object also .everything is working fine, except in case of regular expression in the source file.otherwise the regular expression control is doing well.
My question is y at the source file side the regular expression is not working
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|
|
Sonia Gupta wrote: var reg = new RegExp("[-+]?[0-9]*\.?[0-9]*");
reg.test(txt1.value)
if ( txt1.value.search(/[-+]?[0-9]*\.?[0-9]*/) == -1 )
return false;
else
return true; Try the above code. In your code new RegExp("[-+]?[0-9]*\.?[0-9]*"); , no need of putting the expression in double quotes. Start and end the expression with / and /.
I see you have improved the style of asking question. Good work
|
|
|
|
|
N a v a n e e t h wrote: txt1.value.search(/[-+]?[0-9]*\.?[0-9]*/) == -1
after inserting the numeric value , i am getting false out of the above expression, y this is happening when using the regular expression at the source file side?
Soniagupta1@yahoo.co.in
Yahoo Messenger Id = soniagupta1
|
|
|
|