|
Why would you need to call a javascript function from a code-behind page?
|
|
|
|
|
wrote: how to write javascript function in html part
Start <script> tag and write your functions like this
<script language="javascript">
function Sample()
{
alert("Hi Javascript");
}
</script>
Put the above code on your head section.
wrote: and how to call it in codebehind in asp.net using c#
Each control will be having one property called attributes. Use
ControlName.Attributes.Add("OnClick","Sample();");
|
|
|
|
|
Javascript is scripting language run at client side it run first before going to server
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Standard explanation #1 (Client vs Server) needed!
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
RichardGrimmer wrote: Standard explanation #1 (Client vs Server) needed!
Sorry but not understoo d
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Hi,
Now i am here with a simple query. I would like to restrict the user input like this "10:00:00 AM". Even if i tried some methods in custom expresions in regular expression validator, i did't got it. will anybody give the correct expression
thanking you in advance
sebastian
|
|
|
|
|
How you want the input to be ?
|
|
|
|
|
User will get a textbox to type in the time
user is suppossed to enter like this "10:00:00 AM" or "11:00:00 PM".
is it possible?
thanks for your reply
sebastian
|
|
|
|
|
In this case, since that is so specific, use 4 drop downs or a date time picker set to show the time in that format.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that.'" - Tommy (Tommy Boy) "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
hi
i want to declare width and height for webform.
or how to resize the webform
i recived your code----
window.open("test.aspx","POPUP","height=500, width=700,status= no, resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no,left=200,top=250,directories=no ");
but where i write it ?
i want it on when i write security code in textbox that time this widow will open.
pls help me.
Gayatri
Gayatri
|
|
|
|
|
when u write some text in your textbox u want to open the pop up window right ?
for that u can right one function in java script and call function ontextchaged event of your textbox.
window.open("test.aspx","POPUP","height=500, width=700,status= no, resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no,left=200,top=250,directories=no ");
it will open pop up window now specify height=as u need and same way for widht in above code line.
Thanks,
Sun Rays
|
|
|
|
|
That code is java script. If you are going to have your code behind send that to the aspx form you need to do a RegisterClientScriptBlock.
If you are using .net 1.1 then the code is like this:
uses System.Text;
...
StringBuilder scriptString.Append("");
scriptString.Append("window.open('test.aspx','POPUP','height=500, width=700,status= no, resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no,left=200,top=250,directories=no ');");
scriptString.Append(@"");
RegisterClientScriptBlock("clientScript", scriptString.ToString);
if you are using .net 2.0:
uses System.Text;
...
// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cs = Page.ClientScript;
Type cstype = this.GetType();
StringBuilder scriptString.Append("");
scriptString.Append("window.open('test.aspx','POPUP','height=500, width=700,status= no, resizable= yes, scrollbars=yes, toolbar=no,location=no,menubar=no,left=200,top=250,directories=no ');");
scriptString.Append(@"");
cs.RegisterStartupScript(cstype, "new Window", scriptString.ToString(), true);
Hope that helps.
Ben
|
|
|
|
|
Try a different subject line. Very Urgent is more likely to be ignored by those who would be must helpful.
only two letters away from being an asset
|
|
|
|
|
Can i send data through querystring and body using HTTP POST method?
mads
|
|
|
|
|
The GET method passes the data through the querystring whereas the POST passes it through the form.
|
|
|
|
|
crazy_mads wrote: What is the difference between HTTP GET and POST method?
Get means all informations send by the browser is visible. In post the information is hidden.
crazy_mads wrote: Can i send data through querystring and body using HTTP POST method?
What do u mean by body ?
|
|
|
|
|
<br />
function GetData()<br />
{<br />
<br />
var url='AJAX.aspx';<br />
<br />
<br />
var reqdBox = GetObject('txtOrderNumber','input');<br />
<br />
<br />
url = url + '?Data=' + reqdBox.value;<br />
<br />
<br />
oxmlhttp.open("GET",url,true);<br />
<br />
<br />
<br />
oxmlhttp.send(null);<br />
<br />
<br />
Now here, when i call oxmlhttp.open("GET",url,true); method, instead of using "GET" can i use "POST" and still send Data=' + reqdBox.value; as a Querystring.
Mads
|
|
|
|
|
Sorry i made mistake
Now here, can i call oxmlhttp.open("GET",url,true); method, instead of using "GET" can i use "POST" and still send Data=' + reqdBox.value; as a Querystring.
Mads
|
|
|
|
|
|
I am able to add controls at runtime but i am not able to specify the height and width of the control.How can i do it ?
Mohinder Singh
|
|
|
|
|
You should be able to. Please provide an example of what you've done.
|
|
|
|
|
Its very simple you have height and width property to control
e.g for TextBox
TextBox txt = new TextBox();
txt.ID = "ControlID"
txt.Width = 50;
txt.Height = 23;
panelSample.Controls.Add(txt);
if you don't have then use style sheet i.e css file and give class name to cssClass property of the control
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
sandeep akhare wrote: txt.Width = 50;
txt.Height = 23;
try: txt.Height = new Unit(UnitType.pixel, 50.00);
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
OOPS thanks for corrections
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Please help me out dear i am not able to get the output .
Mohinder Singh
|
|
|
|