Mixing client side scripts with ASP.NET
This adds cient side events to server posting asp.net objects
aspnetobjecthere.Attributes.Add("onClick","functionhere()");
where functionhere() is a javascript function
Welcome! This is my blog where I post mostly tech stuff but other stuff too so have a look!
insert into mytable ('id','text',Now(),'helooo');
bindeddatetime.Hour
indeddatetime.ToShortDateString();
Conclusion
while(mydatareader.Read())
{
DateTime thedate=Convert.ToDateTime(mydatareader["timefield"]);
//notice time field not converted to string at all, just binded straight to a DateTime
}
Create a request sender poining it to an aspx page with the querystring "number" and tell it which function to use to handle the request ("handleResponse")
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
function sndReq(thenumber) {Create the request handler "handleResponse", returnpanel is a div tag to recieve the contents of the request.
http.open('get', 'example1service.aspx?number='+thenumber);
http.onreadystatechange = handleResponse;
http.send(null);
}
above; the "example1service.aspx" page simply takes the querystring and Response.Write 's it* 10 (for example) , also a try/catch for if the data sent was not an integer.
NOTE: the example1service.aspx page has ContentType="Text" in the header
function hideemo()
{
if(document.getElementById('emotions').style.display == 'none')
{
document.getElementById('emotions').style.display = 'block'
}
else
{
document.getElementById('emotions').style.display = 'none';
}
}
<form name="testform">
<select name="tom"><option value="http://www.google.co.uk">Google</option></select>
</form>
Check this variable;
testformtom.options[testform.tom.selectedIndex].value