|
Try This,It worked for me
char[] splitter = { ';' };
string[] MailIdTo = txtMailTo.Text.Split(splitter);
string[] MailCc = txtMailCc.Text.Split(splitter);
string[] MailBcc = txtMailBcc.Text.Split(splitter);
MailMessage mailToSend = new MailMessage();
if (txtAuthenticationMailId.Text != "")
mailToSend.From = new MailAddress(txtAuthenticationMailId.Text);
else
mailToSend.From = new MailAddress("XYZ@gebbs.com");
for (int i = 0; i < MailIdTo.Count(); i++)
{
if (MailIdTo[i] != "")
mailToSend.To.Add(new MailAddress(MailIdTo[i]));
}
if (txtMailBcc.Text != "")
{
for (int i = 0; i < MailIdTo.Count(); i++)
{
if (MailCc[i] != "")
mailToSend.Bcc.Add(new MailAddress(MailCc[i]));
}
}
if (txtMailCc.Text != "")
{
for (int i = 0; i < MailIdTo.Count(); i++)
{
if (MailBcc[i] != "")
mailToSend.CC.Add(new MailAddress(MailBcc[i]));
}
}
if (FileUpload1.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload1.PostedFile.FileName);
mailToSend.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileName));
}
if (FileUpload2.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload2.PostedFile.FileName);
mailToSend.Attachments.Add(new Attachment(FileUpload2.PostedFile.InputStream, FileName));
}
if (FileUpload3.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload3.PostedFile.FileName);
mailToSend.Attachments.Add(new Attachment(FileUpload3.PostedFile.InputStream, FileName));
}
if (FileUpload4.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload4.PostedFile.FileName);
mailToSend.Attachments.Add(new Attachment(FileUpload4.PostedFile.InputStream, FileName));
}
if (FileUpload5.HasFile)
{
string FileName = System.IO.Path.GetFileName(FileUpload5.PostedFile.FileName);
mailToSend.Attachments.Add(new Attachment(FileUpload5.PostedFile.InputStream, FileName));
}
mailToSend.IsBodyHtml = true;
mailToSend.Body = txtBody.Text;
mailToSend.Subject = txtSubject.Text;
SmtpClient smtpMesg = new SmtpClient();
smtpMesg.Host = "smtp.emailsrvr.com";
smtpMesg.UseDefaultCredentials = false;
if (txtAuthenticationMailId.Text != "" && txtPassword.Text != "")
smtpMesg.Credentials = new System.Net.NetworkCredential(txtAuthenticationMailId.Text, txtPassword.Text);
else
smtpMesg.Credentials = new System.Net.NetworkCredential("XYZ@gebbs.com", "passw0rd");
smtpMesg.Send(mailToSend);
|
|
|
|
|
First, sorry if this is a numbskull question:
Is there a way to catch a 'start up' event from IIS?
Here is the problem:
I have a significant amount of data to cache when the web-service starts up and I have not found a way to (reliably!) get notified when the web service is first started.
If I could catch that event, then I could do all the data pre-fetches before the first web service caller comes in.
Thanx in advance.
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Hello all,
This is more of a posting of my findings. I traced the issue I had with an ajax script error. Since I found little information on the web on a fix for it, I wanted to make this post.
The Issue:
I have an ajax call to a script that returns contact information stored in a database. The xml result looks like this
<rs>
<coname>A Company</coname>
<addr>123 main st.</addr>
<city></city>
<state></state>
<zip>77001</zip>
</rs>
When the returned information include fields that are empty ie will throw an error "object required" when you try to access the value like...
document.getElementById("city").value = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
...this is the source of the ie error, firefox does not generate an error.
Testing for empty string or null has no effect.
To work around it you can test for an empty sring in the result from the database query and either use a character string to test for in your callback function or leave the value out of the xml and test for undefined. Like..
<rs>
<coname>A Company</coname>
<addr>123 main st.</addr>
<city>-1</city>
<state>-1</state>
<zip>77001</zip>
</rs>
or
<rs>
<coname>A Company</coname>
<addr>123 main st.</addr>
<zip>77001</zip>
</rs>
Anyone else have ideas on this issue, I would like to hear them.
All the Best!
|
|
|
|
|
if(xmlDocument.getElementsByTagName("city")){
if(xmlDocument.getElementsByTagName("city").childNodes){
alert(xmlDocument.getElementsByTagName("city")[0].nodeValue)
}}
That's just a sorta, the idea is to test
for the object before accessing its property.
modified on Thursday, April 1, 2010 7:27 PM
|
|
|
|
|
the check I was using...
if(typeof xmlDoc.getElementsByTagName("city")[0].childNodes[0] != "undefined")
{
document.getElementById("city").value = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
}
IE did not complain about the object (childNode[0]) being undefined. Nor did FF. FF just assigned a blank string to city and IE would choke at the assignment and toss the error.
Maybe I could have done this to check if the value is set, but I have not checked if it is even valid.
if(typeof xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue != "undefined")
I now use this and it works fine...
if(typeof xmlDoc.getElementsByTagName("city")[0].childNodes[0] != "undefined")
{
if(xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue!="-1")
{
document.getElementById("city").value = xmlDoc.getElementsByTagName("city")[0].childNodes[0].nodeValue;
}
else
{
document.getElementById("city").value = "";
}
}
I check server side for an empty string and instead return a -1 when one is found.
|
|
|
|
|
Ok so I'm new(ish) to web stuff being predominantly a C/C++ programmer up to now. I'm looking to produce my own website (for fun (!)) to display photos in gallery and slideshow form, I'd like it to be flashy and cool with nice transitions between photos, lots of shiny things, reflections etc ( )
Whats the best route to go down as regards what language(s) to start with?
|
|
|
|
|
The language doesn't really matter, you can do all if with html and JavaScript.
However, it would be an easier transition from C++ to C# and JavaScript since the syntax and structure is very similar.
I would recommend looking at the JQuery as it provides a nice library of useful UI widgets and functions for JavaScript. Silverlight would also get you the very flashy coolness but it has a learning curve for one not accustomed to .NET
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Thanks for the advice - what sort of tools should I be using for Javascript?
|
|
|
|
|
You don't need any tools except notepad really. VS will give intellisence if it's setup, but that won't help with learning the language. For that you would need to pick up book or look on the web, plenty of resources there.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
cheers - I'll get started, watch this space...
|
|
|
|
|
html,javascript and css2.1 to start.
then work into a server side script like php.
next would be to learn to code ajax.
keep an eye on html5 and css3 too, I suspect it is coming online quicker than most think and can displace both silverlight and flash.
---------
tools I use is notepad++ on windows and bluefish editor on linux, both free
use firefox with its webdeveloper and firebug addons to run and debug scripts.
of course a webserver, iss is ok, but I like abyss webserver [x-1 I think] (again free)
|
|
|
|
|
Most of your decisions will be based on where you intend to HOST[^] your site? Many web hosts provide api s to display photos in gallery and slideshow form.
|
|
|
|
|
daveyerwin wrote: Many web hosts provide api s to display photos in gallery and slideshow form
Yeah but it's a project you know - sort of a training exercise!
|
|
|
|
|
Then you please start with php which exposes behind the scenes completely were as in .net you will never or probably will not know how the request and response are taking place or you will not understand the client server concept. Because in php every concept and functions are straight forward and that will sure make you understand the concept behind. and with respect to .net or c# all are wrappers so you will not know the real true concept behind HTTP, requests and responses and client server. Besides these you will easily gt exposed to other protocols like FTP, IMAP, SMTP and you can implement then just like your normal c program functions. Hope you can understand what i am talking about. since you said that you are basically from c and c++, php is totally like c and all the core functionality can be handled the same way like in c but if it is c# you need to wrap and wrap and wrap for a single silly socket connection or any client server request. PHP make things very very simple and it trails you to lot of basic stuff you need to know as a beginner web programmer. for this in the client side use firefox with firebug to debug/trace css, javascript and the client server requests and responses. enjoy.
So finally for your point ... it should be php. it is really like child's play. all you need to do is wind the key and see the result.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Thanks all for the suggestions, I'll bear them all in mind, do some research and head off to the appropriate forum with a bagful of questions
|
|
|
|
|
No Contract Instructor Regurgitating Someone Else's Materials! Learn from the Expert!
Bangalore, March 31, 2010: The best of India's Java and RIA programmers have learnt the subject from Marty's seminal books Core Servlets and JavaServer Pages (first and second editions), More Servlets and JavaServer Pages, and Core Web Programming (first and second editions) from Prentice Hall and Sun Microsystems Press. Now is the opportunity to meet him and learn from him first-hand. From 26-28 April in Bangalore, India, attend a practical, hands-on training on Ajax and RIAs personally developed and taught by leading Java EE and Ajax developer, speaker, and author Marty Hall
"Ajax" designates the set of techniques that enable Web applications to asynchronously update small portions of the pages based on server-side data. First popularized by Google, these techniques are now being widely applied in Web applications, and increase the performance, flexibility, richness, and interactivity of Web sites and Web-based applications. However, Ajax programming is complex and poorly understood. In the course, for client-side code, the class uses jQuery, the single-most widely used JavaScript library. For server-side code, the class uses Java. The class also covers foundational topics like JavaScript programming, core Ajax approaches, XML and JSON data handling, and Ajax development and debugging tools.
Marty has taught Ajax, GWT, and Java EE courses onsite for dozens of organizations in the US, Canada, Mexico, Australia, Japan, Puerto Rico, India, and the Philippines, all to rave reviews. The course consists of an approximately equal mixture of lecture and hands-on lab time and assumes that all students have moderate-to-strong Java skills and at least a little bit of experience with Web apps in Java (servlets and/or JSP). The course does not assume any previous exposure to Ajax, nor does it presume JavaScript knowledge.
For more information and to register, see: http://www.saltmarchi.com/expertNetworks/training/Ajax.html
A Saltmarch Media Press Release
E: info@saltmarch.com
Ph: +91 80 4005 1000
|
|
|
|
|
If you want to advertise try paying for it.
me, me, me
"The dinosaurs became extinct because they didn't have a space program. And if we become extinct because we don't have a space program, it'll serve us right!"
Larry Niven
|
|
|
|
|
Hi there community!
I'm having a little problem with two scripts that seem to be conflicting with each other inside a web page. whicever one I load first will work but the second wont - I skimmed through then to see if there were any conflicting var or function names but couldn't find anything... any suggestions?
This is an analog clock script inside an absolute positioned div:
<script type="text/javascript">
var second_hand_colour="#C3C3C3";
var minute_hand_colour="#77A476";
var hour_hand_colour="#578256";
var facia_colour="#fff";
var face_colour="transparent";
var xoffset=40;
var yoffset=40;
var size=110;
var facia=String.fromCharCode(9660)+" 1 2 "+String.fromCharCode(9668)+" 4 5 "+String.fromCharCode(9650)+" 7 8 "+String.fromCharCode(9658)+" 10 11";
var clok;
var newx=xmo=800;
var newy=ymo=160;
window.onload=function() { if (document.getElementById) {
var i, j, k;
clok=document.createElement("div");
clok.style.position="absolute";
if (face_colour!="transparent") for (i=0; i<size; i++) {
j=createDiv(false, face_colour);
if (document.all) j.style.filter="Alpha(Opacity=50)";
else j.style.opacity=0.5;
k=size*Math.sqrt(i/size-Math.pow(i/size, 2));
j.style.left=size/2-k+"px";
j.style.top=i+"px";
j.style.height="1px";
j.style.width=k*2+"px";
clok.appendChild(j);
}
for (i=1; i<size/4; i++) {
j=createDiv("sec"+i, second_hand_colour);
j.style.height="2px";
j.style.width="2px";
clok.appendChild(j);
}
for (i=1; i<size/4; i++) {
j=createDiv("min"+i, minute_hand_colour);
j.style.height="3px";
j.style.width="3px";
clok.appendChild(j);
}
for (i=0; i<size/6; i++) {
j=createDiv("hour"+i, hour_hand_colour);
j.style.height="4px";
j.style.width="4px";
if (!i) j.style.top=j.style.left=size/2-2+"px";
clok.appendChild(j);
}
facia=facia.split(" ");
for (i=0; i<12; i++) {
j=createDiv(false, "transparent");
j.style.color=facia_colour;
j.style.font="bold 10pt monospace";
j.style.overflow="visible";
j.appendChild(document.createTextNode(facia[i]));
j.style.top=size/2-7-size/2*Math.cos(i*Math.PI/6)+"px";
j.style.left=size/2-5+size/2*Math.sin(i*Math.PI/6)+"px";
clok.appendChild(j);
}
document.body.appendChild(clok);
tick();
tock();
}}
function tick() {
var i, j;
var now=new Date();
var sec=(now.getSeconds()+(now.getMilliseconds()%1000)/1000)*Math.PI/30;
for (i=1; i<size/4; i++) {
j=document.getElementById("sec"+i).style;
j.left=size/2+2*i*Math.sin(sec)-1+"px";
j.top=size/2-2*i*Math.cos(sec)-1+"px";
}
xmo+=Math.floor((newx-xmo)/4);
clok.style.left=xmo+"px";
ymo+=Math.floor((newy-ymo)/4);
clok.style.top=ymo+"px";
setTimeout("tick()", 40);
}
function tock() {
var i, j;
var now=new Date();
var min=(now.getMinutes()+now.getSeconds()/60)*Math.PI/30;
var hrs=(now.getHours()+now.getMinutes()/60)*Math.PI/6
for (i=1; i<size/4; i++) {
j=document.getElementById("min"+i).style;
j.left=size/2+2*i*Math.sin(min)-1.5+"px";
j.top=size/2-2*i*Math.cos(min)-1.5+"px";
}
for (i=1; i<size/6; i++) {
j=document.getElementById("hour"+i).style;
j.left=size/2+2*i*Math.sin(hrs)-2+"px";
j.top=size/2-2*i*Math.cos(hrs)-2+"px";
}
setTimeout("tock()", 999);
}
function scro() {
var scro=0;
if (document.body.scrollTop) scro=document.body.scrollTop;
else if (document.documentElement && document.documentElement.scrollTop) scro=document.documentElement.scrollTop;
return (scro);
}
function createDiv(id, bg) {
var div=document.createElement("div");
div.style.position="absolute";
div.style.overflow="hidden";
div.style.zIndex="4";
div.style.backgroundColor=bg;
if (id) div.setAttribute("id", id);
return (div);
}
</script>
//* And this is a non-interactive image carousell */
<script type="text/javascript">
var sliderwidth="699px"
var sliderheight="100px"
var slidespeed=3
slidebgcolor="#fff"
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<img src="fotos/slide1.jpg">'
leftrightslide[1]='<img src="fotos/slide2.jpg">'
leftrightslide[2]='<img src="fotos/slide3.jpg">'
leftrightslide[3]='<img src="fotos/slide4.jpg">'
leftrightslide[4]='<img src="fotos/slide5.jpg">'
var imagegap=" "
var slideshowgap=5
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftrightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slidemenu2
ns_slide2=document.ns_slidemenu.document.ns_slidemenu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style.left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style.left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.style.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style.left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshowgap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshowgap
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+sliderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+sliderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
any ideas/suggestions?
(sorry about the long message, I hope it won't be too much of a nuisance)
|
|
|
|
|
These two scripts each define window.onload so
because of that they cant be in the same web page
together.One solution would be to combine the two functions so
that each have the same code.
|
|
|
|
|
|
I have a linkbutton and while ctrl+click that link i need to do something.So i added keyup and keydown events for document and set a variable true or false according to the Ctrl+click and after checking it in onclick event of linkbutton.everything working fine and behave as expected.But this logic will fail in one scenario. ie, a user Ctrl+click a page in one tab of browser and releasing the ctrl key in another tab which is selected with the mouse without releasing the ctrl key. I guess its difficult to handle that. any hacks?
|
|
|
|
|
|
I uploaded a website to the host and now only get This[^].
There is a Default.aspx, so why doesn't it go straight in to the web page?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Go to the IIS-configuration, find the website, click Properties and go to the Documents tab. Can you verify whether "Default.aspx" is in that list?
I are Troll
|
|
|
|
|
Whoa, slow down!
Talk me through that slowly please.
Where and How, to start with!
Where do I go to get the IIS config?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|