Friday, June 03, 2005

Add a javascript to web Serve control

make function with javascript code and register it as under
private void setupClientScript() {
string js = @"
function ChageRadioMake() {
if(document.Form1.txtMake.value != """") {
document.Form1.rdo_othermake.checked = true;
}
if(document.Form1.txtModel.value != """"){
document.Form1.rdo_othermodel.checked = true;
}
}";


//Register the script

if (!IsClientScriptBlockRegistered("ChageRadioMake")) {
RegisterClientScriptBlock( "ChageRadioMake", js );
}
}

On Page load event put the following code :
setupClientScript(); // call the function to register javascript

txtMake.Attributes.Add("onblur","ChageRadioMake();");
//Add attribute to the control attach javascript with control event...


#######################

<% Set Mail = CreateObject("CDONTS.NewMail")
Mail.To = "mailto@servename.com"
Mail.From = "mailfrom@companyname.com"
Mail.BodyFormat=0
Mail.Mailformat=0
Mail.Subject= "this is the Email subject"dim vBody ' html string -- body part
vBody = ""
Mail.Body = vBody
Mail.Send
%>Set Mail = CreateObject("CDONTS.NewMail")Mail.To = "mailto@servename.com" Mail.From = "mailfrom@companyname.com"Mail.BodyFormat=0Mail.Mailformat=0Mail.Subject= "this is the Email subject"dim vBody ' html string -- body partvBody = ""Mail.Body = vBodyMail.Send