Violet_82 89 Posting Whiz in Training

Ah, but this appears to work http://s27.postimg.org/ajkla4m4z/local_DB.jpg for whatever reason...what does it mean?

Violet_82 89 Posting Whiz in Training

Thanks, but it doesn't work, http://s17.postimg.org/m30lznb73/sql_Express.jpg
Now, what gets me is that at work I have the same version of visual studio and the same operating system and I can connect to localhost/SQLEXPRESS and at home I can't. I had a look online but I couldn't find out why it is that I can't do the same thing at home? Presumably some piece of software is missing here on my home computer? If it helps, I have installed this today http://msdn.microsoft.com/en-us/jj650015 thinking that it would solve my problem but it didn't

Violet_82 89 Posting Whiz in Training

This is the first screen
http://s14.postimg.org/4d4jcboip/enu.jpg then when I select neograb this appears:
http://s13.postimg.org/okiducm1z/prompt.jpg but how do I start ubuntu?

Violet_82 89 Posting Whiz in Training

Hi guys, I hope this is the right section to post. I need to develop an application in visual studio 2012 that uses SQL (please bear with me as I'm not very well versed in databases and SQL and therefore I don't know what SQL visual studio uses), and when I attempt to create a new database I get and error, here is the screenshot http://s12.postimg.org/wsxldwwgd/sql.jpg
Now, when I used visual studio 2008 to create a database I used the following options:

Server name:localhost\SQLEXPRESS
Windows authentication
New daabase name: test0

and everything worked OK, but with VS 2012 it looks like it doesn't like SQLEXPRESS.
Does anybody know how to get VS to work with the above options?
Any help or hint will be much appreciated

Violet_82 89 Posting Whiz in Training

Hi, sorry I was in a bit of a rush and went ahead, I found the restore utility and reinstalled windows 7 (curiously while I was doing a message informed me that it would have wiped out only the partition where windows was installed). Anyway, here is the screenshot of my disk, after I reinstalled windows http://s15.postimg.org/sjfwy031n/disk.jpg
I don't understand why I have so many partitions:
1)102MB; I guess that's something that windows uses, not bothered with it as it is not a lot
2)Recovery: OK we know what that is
3)OS C: my windows partition;
4)158.32GB: now, could that be the partition where linux is installed? As I said above, when I reinstalled windows it said it formatted only the current partition where windows was installed. If that's linux, how do I boot in it, since it doesn't give me the dual boot option at the startup anymore? Can I boot in linux, or is it "lost"?
5)7.91GB: what is it? ANy idea?
thanks

Violet_82 89 Posting Whiz in Training

yes working perfectly now, thanks!

Violet_82 89 Posting Whiz in Training

thanks for your help

Violet_82 89 Posting Whiz in Training

And something interesting to note as well: with the addition of ClientIDMode to the radio button, I can remove the AssociatedControlID property and it will work anyway as the id's are not changing anymore

Violet_82 89 Posting Whiz in Training

Ah yes, I remember you saying that, but I had an old version of visual studio so I couldn't do that as it wasn't supported. I have now upgraded a little, so I'll try that! That makes me think though, what happens if I still had the old version of visual studio that didn't support ClientIDMode?

Violet_82 89 Posting Whiz in Training

Ah, of course, the function is not called unless I post back!! Darn! Yes, I can certainly do it with Jquery, that was in fact my first thought, but I did it with C# because I wanted to practice : - ), and I thought that for such a small application it won't matter that much if I use server processing

Violet_82 89 Posting Whiz in Training

HI guys, I'm having a problem with hiding and showing a panel that contains a text box. Basically the panel is hidden and whenever a radio box is selected the panel should show but it won't work.

Here is the code:

 <div class="expensesForm">
        <div class="control-group">
            <label class="control-label" for="rent">Rent</label>
            <div class="controls">
                <asp:RadioButton ID="rent" runat="server" GroupName="expenses" OnCheckedChanged="CheckedChanged" />            
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="car">Car</label>
            <div class="controls">
                <asp:RadioButton ID="car" runat="server" GroupName="Expenses" OnCheckedChanged="CheckedChanged" />
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="bills">Bills</label>
            <div class="controls">
                <asp:RadioButton ID="bills" runat="server" GroupName="Expenses" OnCheckedChanged="CheckedChanged" />            
            </div>
        </div>
        <div class="control-group">
            <label class="control-label" for="food" AssociatedControlID="food">Food</label>
            <div class="controls">
                <asp:RadioButton ID="food" runat="server" GroupName="Expenses" OnCheckedChanged="CheckedChanged" />            
            </div>
        </div>
         <div class="control-group">
             <asp:Panel ID="amount" runat="server">
                  <label class="control-label" for="bills">Enter amount</label>
                <div class="controls">
                    <asp:TextBox ID="TextBox1" runat="server" Visible="True"></asp:TextBox>
                </div>
            </asp:Panel>
        </div>
    </div>

And the code behind here, however when I select the radio button the panel doesn't appear:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {//returns false the first time the page is displayed true when redisplayed
            initForm();
        }

    }
    private void initForm() {
        amount.Visible = false;//hide amount info on page load
        rent.Checked = false;//unselect all radio buttons
        car.Checked = false;
        bills.Checked = false;
        food.Checked = false;

    }
    protected void CheckedChanged(object sender, EventArgs e)
    {
        amount.Visible = true;//showamount info on page load
    }
}
Violet_82 89 Posting Whiz in Training

I'm such an idiot, sorry I copied the wrong one, here's the right one:
ASP code

<div class="control-group">
    <label class="control-label" for="food" AssociatedControlID="food">Food</label>
    <div class="controls">
        <asp:RadioButton ID="food" runat="server" GroupName="Expenses" />            
    </div>
</div>

Generated code:

<div class="control-group">
    <label class="control-label" associatedcontrolid="food" for="food">Food</label>
    <div class="controls">
        <input id="ContentPlaceholder_food" type="radio" value="food" name="ctl00$ContentPlaceholder$Expenses">
    </div>
</div>

As you can see the input id isn't food but ContentPlaceholder_food

Violet_82 89 Posting Whiz in Training

thanks. To be honest, I've never tried the VM before, so I'm not totally opposed to it. If I do have a VM with multiple OS, will I be able to save files in the guest OS, as in will I be able to operate the guest OS as I can do now with a dual boot? How many OS can I have with a Vm? Is running a VM free or does it involve paying a fee?

Saying that though, the OS's might run a bit slower than if you have a dual boot.

Violet_82 89 Posting Whiz in Training

No idea if it has a hidden partition, but I'd assume so, because the laptop didn't come with any CD when I bought it. Is there a way to discover this hidden partition and its content?
It kind of crossed my mind to have a VM, but then again, I use both linux and windows (the former on a daily basis, the latter everytime I need to do any dev work, which is more and more often now, so I rather keep both OS. I don't format the HD that often - on this machine this is the first time in 4 yrs, so I don't mind reinstalling everything). So you think it is better to wipe everything rather than trying to keep the linux partition?

Violet_82 89 Posting Whiz in Training

HI guys, I need to format andn reinstall windows 7 on my dell xps 17. Two things though: I don't have any windows installation disk - I suppose there will be a windows 7 iso stored by the manufacter somewhere - and it's dual boot as I have linux installed on another partition. Ideally I would like to format just the windows partition and reinstall it, leaving the linux partition untouched. Is that doable? If so, what are the steps I should take (a search on the net wasn't particularly helpful, so if you guys could point me to a good resource I'd be extremely grateful!)
thanks

Violet_82 89 Posting Whiz in Training

Well, that's rather interesting then: take a look at my code instead (sorry I changed it slightly but in the generated code the value of the "for" attribute is diffente from the value of the id)
ASP code:

<div class="control-group">
            <label class="control-label" for="bills">Bills</label>
            <div class="controls">
                <asp:RadioButton ID="bills" runat="server" GroupName="Expenses" />            
            </div>
        </div>

Now check out the generated code:

 <div class="control-group">
            <label class="control-label" for="bills">Bills</label>
            <div class="controls">
                <input id="ContentPlaceholder_bills" type="radio" name="ctl00$ContentPlaceholder$Expenses" value="bills" />            
            </div>
        </div>

Um, no wonder it doesn't work. Is there a way around this, meaning a way to tell asp to keep the id value as I specified it?

Violet_82 89 Posting Whiz in Training

Um, it doesn't work for me...so you don't get any error message? I'm on VS 2012

Violet_82 89 Posting Whiz in Training

Hi all, I just came across something odd.
I'm just building a simple form, like this in visual studio

<div class="control-group">
            <label class="control-label" for="rent">Rent</label>
            <div class="controls">
                <asp:RadioButton ID="rent" runat="server" GroupName="expenses" />            
            </div>
        </div>

and when I viewed it, I expected to be able to click on the label and get the corresponding radio button checked, but alas, that doesn't work. I know I can do that if I use a HTML radio button, but this time, for a change, I want to use a asp radio button. So, first things first: I checked and that label renders as a normal label in the HTML, so no problem there. I came across this interesting post http://laak.fi/2012/09/associated-form-elements-and-labels-in-asp-net-webforms/ which esentially says that I need to add a AssociatedControlID attribute to my label, whose value will be the id of the hradio box, like this
AssociatedControlID="rent" but no joy, nothing changes and in fact visual studio says: "validation XHTML5: this name contains upper characters which is not allowed". Eh? XHTML5? Who set that? my document type is HTML 5, not sure where that comes from, but anyway, point being I can't get that label and radio button to behave the way I want them to do. Does anybody have a clue?

Violet_82 89 Posting Whiz in Training

OK I see, so should be fine now then!Yes, email received, thank you very much for submitting it, much appreciated!

Violet_82 89 Posting Whiz in Training

OK, apparently it was a security issue as I got this email:

Hi bassa,

Someone recently used your password to try to sign in to your Google Account bassabasso@gmail.com. This person was using an application such as an email client or mobile device.

We prevented the sign-in attempt in case this was a hijacker trying to access your account. Please review the details of the sign-in attempt:

    Tuesday, December 9, 2014 9:58:20 AM UTC
IP Address: xxxxxxxxx
Location: Unknown


If you do not recognize this sign-in attempt, someone else might be trying to access your account. You should sign in to your account and reset your password immediately.

Reset password

If this was you, and you are having trouble accessing your account, complete the troubleshooting steps listed at http://xxxxxx 

Sincerely,
The Google Accounts team    

I followed the instructions and unlock the captcha, so now it works, but I hope it works from any device. You couldn't do me a favour and try to submit the form please? Just fill it with rubbish data, that'll be very helpful, thanks :-)!

Violet_82 89 Posting Whiz in Training

Hi guys, does anybody have any experience with Azure at all? I finally deployed a test site I built http://web-dev.azurewebsites.net/About.aspx and unfortunately there seems to be a problem when you submit the form (obviously I tested the form many times before deploying the site and it was definitely working in my localhost as I've received all the emails generated): you'll get an error message:

Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.


<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

Now, being really new to Azure, I have no idea what can cause the problem, and I'm not sure how to implement the change the error is …

Violet_82 89 Posting Whiz in Training

Cool, thanks. OK so I'll build the interface first, and then will have a look at a few SQL tutorials, I'm sure I'll post back. I'll close this thread as my questions will no doubt be more specific
Cheers

Violet_82 89 Posting Whiz in Training

Thanks JorgeM.
A few points. The amount of fields in the “expenses” sounds good, but I was wondering whether having 2 tables will not create additional problems when it comes to getting out the data from the table. Also, presumably the two tables will have to be linked somehow otherwise what’s the point of storing an int reference to another table? Any hint about how to do that, what I need to look into?
About grouping data, where should the data be organised/grouped, in its own SQL table or after I extract the data? What I mean is, if you think about the way I want to display my results, as my previous post, how can I extract that data? I should filter all the “transactions” that took place in November (so presumably grouping transactions by month), then add up all different types of transactions (1,2,3,4,5) for that specific month, correct?

Violet_82 89 Posting Whiz in Training

Hi all,
just to practice a bit more with asp.net and c#, I was thinking to build a small application to keep an eye at my monthly and yearly expenses (rent, car, bills, food shopping). I have a few ideas but I thought I'd check with you guys what's the best way to build this, mostly when it comes down to store and retrieve info from the database.
I'm thinking to start with a page containing a form with the following input fields:

Rent:
-Rent cost
Car:
-Car cost
Bills:
-Bills
Food
-Food shopping

When I submit the form the data will be saved in the database (I will obviously allow for blanks in the above form as not all the expenses occur on a monthly basis).
Then there will be another page which displays my results at the end of the month, something like this:

October 2012
Rent cost: this month you've spent xxx£
Car cost: this month you've spent xxx£
Bills cost: this month you've spent xxx£
Food cost: this month you've spent xxx£

November 2012
Rent cost: this month you've spent xxx£
Car cost: this month you've spent xxx£
Bills cost: this month you've spent xxx£
Food cost: this month you've spent xxx£

December 2012
Rent cost: this month you've spent xxx£
Car cost: this month you've spent xxx£
Bills cost: this month you've spent xxx£
Food cost: this month you've spent xxx£

Now let's turn to the database side: here is …

Violet_82 89 Posting Whiz in Training

cool, thanks for that!

Violet_82 89 Posting Whiz in Training

No problem :-)!

Violet_82 89 Posting Whiz in Training

Ah OK, then I have no idea. Oh don't worry mate, I don't want to waste your time, now I know that the other version works so it's OK :-)

Violet_82 89 Posting Whiz in Training

Sure yes, I was more after what's good practice and what's not really. As you know I'm new, so the first approach didn't seem to be too wrong till you said that the panel was a better option. Still in the first attempt I was doing it server side

Violet_82 89 Posting Whiz in Training

I just discovered that ClientIDMode isn't available for asp.net 3.5...no wonder why I couldn't get it to work!

Violet_82 89 Posting Whiz in Training

OK thanks

Violet_82 89 Posting Whiz in Training

Oh really can you do that? I thought that to install the newer version you had to get rid of the older one

Violet_82 89 Posting Whiz in Training

ouch...
So presumably if I can use VS 2008 I could use 2013 as well, as in, it's not that much different, as far as you know?
I just find it really irritating that there is so little good support on the net for old software

Violet_82 89 Posting Whiz in Training

Yes, CssClass just like other controls.

So you imply that the class needs to be applied dynamically, but, after I posted this, I tohught I'd try to hard code it, and it looks like it worked (it compiled and the css was there in firebug):

<asp:Panel ID="ThankYouPanel" runat="server" class="thisPanel">
        <div class="thankYouMsg" id="thankYouMsg" runat="server">
          <h2>Thank you for your feedback.</h2>
        </div>
    </asp:Panel>

"You can, but you'll need to use something like this:
<%= ThankYouPanel.ClientID %>
"(sorry the 'quote' doesn't seem to work with code)

Do you mean that goes in the aspx file? So it's a placeholder: is there anywhere I can read more about that, in terms of general rules etc etc

"as you can't be absolutely sure it will be and stay
ctl00_contentPlaceholder_ThankYouPanel
"
Why not? I mean once I check in firebug that the id is that, can it possibly change?

Violet_82 89 Posting Whiz in Training

Hi all, I have visual studio 2008 and as I recently started to use it, I still develop the HTML from scratch and then move it to ASP.NET. Anyway, when I did my last site and uploaded the CSS in visual, I got quite a lot of CSS 3 error validation, like
Validation (CSS 2.1): 'box-sizing' is not a known CSS property name etc etc, so clearly VS2008 doesn't support CSS3. I had a good look around on the net, and apparently you can change those errors (which by the way don't prevent me from compiling) into warnings - although to be fair I couldn't do it on my copy - but more importantly, I need CSS 3 support. I found a few posts on different blogs here and there about possible solutions like this http://blogs.msdn.com/b/mikhailarkhipov/archive/2007/10/19/how-to-create-custom-css-intellisense-schema-in-visual-studio-2005-and-2008.aspx but I don't have access to the registry of this machine due to permissions so I wonder, is there a quick and easy solution, or is it just not possible to do it and I have to upgrade to a higher version of VS?
thanks

Violet_82 89 Posting Whiz in Training

Hello guys, I'd like to clarify a few things with IDs and classes. As I've learned so far, ASP.NET adds its own id and overwrite the previous one, if there was any. Let's just take a recent example, the panel I added in my previous thread:

<asp:Panel ID="ThankYouPanel" runat="server">
        <div class="thankYouMsg" id="thankYouMsg" runat="server">
          <h2>Thank you for your feedback.</h2>
        </div>
    </asp:Panel>

OK, so I want this panel to be hidden when the page load. Glossing over the fact that it could be easily done in c# with

protected void Page_Load(object sender, EventArgs e)
    {
        ThankYouPanel.Visible = false;//hide thank you message
        ...
     }

(in fact let's comment that out), I thought I'd like to do it in the CSS, because undoubtly as I progress with ASP.NET there will be times when that's necessary. So, how do I do it then?! If I check firebug the id of the panel (which is now rendered as a div) isn't in fact ThankYouPanel anymore but it's now ctl00_contentPlaceholder_ThankYouPanel. So, what do I do? Can the panel have a class? Do I target that id? What really confuse me the most though, is the fact that, even though the id is now different I can still use it in the code behind...
So I can do this ThankYouPanel.Visible = false; using the original id, which as we know, is now gone...why?! Is that because the id gets changed after compilation and the code behind somehow runs before?! WOuld be grateful if somebody could …

Violet_82 89 Posting Whiz in Training

All right, I did just that, wrapped the form and the thank you message in two separate panels and then

 ContactFormPanel.Visible = false;
  ThankYouPanel.Visible = true;

In the situation I had before when I was adding the class in that funky way:

//hide form and show thank you message with no panel
            //contactForm.Attributes.Add("class", contactForm.Attributes["class"] + " hidden");
            //thankYouMsg.Attributes.Add("class", thankYouMsg.Attributes["class"] + " active");

Is it really wrong?

Violet_82 89 Posting Whiz in Training

@hericles yes that crossed my mind when I was building the form, but I thought i'd use c# to practice; so, if the form gets submitted (if you don't feel in the enquiry field it won't submit) the message is displayed.

@JorgeM that's fine, if you tell me that the panel is a better approach I will use that, but I first need to have a look at how to use it as I've never used it. SO basically the form needs to be in a panel and the thank you message in another correct? Then both of them will have their own ID and when in the code behind the submitData method is called I set one active and one hidden?

Violet_82 89 Posting Whiz in Training

Yep, but it made no difference as I tried with and without that...that's why I;m puzzled.
Could it be the order, that's the only significant difference...

Violet_82 89 Posting Whiz in Training

I noticed problems, well at least that's in my case, when I develop in localhost: it had happened to me more than once that chrome was playing up but when I set the site "live" it was fine. Not sure if this can be of any help

Violet_82 89 Posting Whiz in Training

Hello guys, I wonder if you could kindly explain this to me.
Basically, I've got a form and a thank you message above it, here they are:

<asp:Content ID="Content5" ContentPlaceHolderID="contentPlaceholder" Runat="Server">
    <div class="thankYouMsg" id="thankYouMsg" runat="server">
        <h2>Thank you for your feedback.</h2>
    </div>
    <div class="contactForm" id="contactForm" runat="server">
        <h2>Contact me</h2>
        <div class="form" runat="server">
            <div class="control-group">        
                <label class="control-label" for="title">Title</label>
                <div class="controls">
                    <select id="title" runat="server">
                        <option>Select</option>
                        <option>Mr</option>
                        <option>Ms</option>
                        <option>Miss</option>
                        <option>Mrs</option>
                    </select>
                </div>
            </div>
            <div class="control-group">        
                <label class="control-label" for="name">Name</label>
                <div class="controls">
                    <input runat="server" type="text" id="name" />
                </div>
            </div>
             <div class="control-group">        
                <label class="control-label" for="email">Email</label>
                <div class="controls">
                    <%--<input id="email" runat="server" type="text" />--%>
                    <asp:TextBox ID="email" runat="server"></asp:TextBox>
                </div>
            </div>
             <div class="control-group">        
                <label class="control-label" for="enquiry">Enquiry<span>*</span></label>
                <div class="controls">
                    <textarea id="enquiry" runat="server" type="text"></textarea>
                    <%--<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>--%>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="Please enter your message" ControlToValidate="enquiry"></asp:RequiredFieldValidator>
                </div>
            </div>
            <div class="submitButton">
                <input id="submitForm" type="submit" value="Submit" runat="server" onserverclick="submitData">
                <div class="clear"></div>
            </div>

        </div>
    </div>
</asp:Content>

The form is display:block; and the thank you message display:none; when you first land onto the page. What I wanted to do was to, upon form submission, display the thank you message and hide the form. well, it wasn't that obvious/easy I have to say and after quite a bit of research and tries,here is the method I used to achieve that, but I'm not convinced it's the best one:

protected void submitData(object sender, EventArgs e) {           
    ...
    //hide form and show thank you message
    contactForm.Attributes.Add("class", contactForm.Attributes["class"] + " hidden");
    thankYouMsg.Attributes.Add("class", thankYouMsg.Attributes["class"] + " active");
}

Right, why did I do that (and please note the space between the " …

Violet_82 89 Posting Whiz in Training

OK, looks like we got it to work...why I don't know, and it's rather interesting.
I must have mentioned in one of the posts that at the email specified I received a few emails saying that access to my account had been blocked bla bla, and there is one option in gmail, not sure how many are aware of it, that essentially allows you to enable/disable "less secure app access" to it. Mine was disabled, and so I enabled, but still my darn code didn't work. Here is it again by the way, just for reference:

protected void submitData(object sender, EventArgs e) {
        //send email
        SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25);
        smtp.Credentials = new System.Net.NetworkCredential("bassabasso@gmail.com", "xxxxxxx");
        smtp.UseDefaultCredentials = true;
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
        smtp.EnableSsl = true;
        MailMessage mail = new MailMessage();
        mail.To.Add(new MailAddress("bassabasso@gmail.com"));
        mail.From = new MailAddress("bassabasso@gmail.com");
        mail.Subject = "test";
        mail.Body = "Hello this is a test";

        //smtp.Host = "smtp.gmail.com";


        smtp.Send(mail);
        //end of send email  
        }

Somebody suggested a few amendments to my code, merely put all the strings into variables, like so:

protected void submitData(object sender, EventArgs e) {
            //send email
            string Subject = "This is test mail using smtp settings";
            string Body = "Hello this is a test";
            string ToEmail = "bassabasso@gmail.com";
            string SMTPUser = "bassabasso@gmail.com", SMTPPassword = "xxxxx";
            SmtpClient smtp = new SmtpClient();

            //smtp.UseDefaultCredentials = true;
            smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
            smtp.EnableSsl = true;
            MailMessage mail = new MailMessage();
            mail.To.Add(ToEmail);
            mail.From = new MailAddress(SMTPUser);
            mail.Subject = Subject;
            mail.Body = Body;
            mail.IsBodyHtml = true;
            //if you are using your …
Violet_82 89 Posting Whiz in Training

yep, the credentials are already there, and I changed the port too, from 25 to 587, no joy...and same error

Violet_82 89 Posting Whiz in Training

I attempted to debug the method in visual studio, and the problem seems to be with this line:
smtp.Send(mail);
When the debugger reaches that line this is what I get:
http://postimg.org/image/u96s6ym65/

Violet_82 89 Posting Whiz in Training

Hi, OK I played around with that a little and eventually I had to change the code and try to send emails through gmail as I don't have access to any other smtp server. So, this is the code that I came up with.
About.aspx:

 <div class="submitButton">
                <input id="submitForm" type="submit" value="Submit" runat="server" onserverclick="submitData">
                <div class="clear"></div>
            </div>

About.aspx.cs

using System.Net.Mail;
...
    protected void submitData(object sender, EventArgs e) {
    //send email
    SmtpClient smtp = new SmtpClient("smtp.gmail.com", 25);
    smtp.Credentials = new System.Net.NetworkCredential("bassabasso@gmail.com", "xxxxxxxx");
    smtp.UseDefaultCredentials = true;
    smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
    smtp.EnableSsl = true;
    MailMessage mail = new MailMessage();
    mail.To.Add(new MailAddress("bassabasso@gmail.com"));
    mail.From = new MailAddress("bassabasso@gmail.com");
    mail.Subject = "test";
    mail.Body = "Hello this is a test";

    //smtp.Host = "smtp.gmail.com";


    smtp.Send(mail);
    //end of send email  
    }

So, following your suggestions, I've specified port 25 but the sender and the recipient address coincides, I hope that's not a problem. I had a very good look on the net, the problem is that everybody seems to be doing it differently, so for me it is quite difficult to judge which one is right and which one is wrong. The above code compiles, but when I press the submit button I get an error and I noticed an interesting fact as well. SO, with order, here is the error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at
Description: An unhandled exception occurred during the execution of the current web request. Please …
Violet_82 89 Posting Whiz in Training

Hello guys,
I have a simple asp.net form and ideally, upon submission, I'd like to forward the form data to an email address. Here is the form:

<div class="contactForm">
    <h2>Contact me</h2>
    <div class="form">   
        <div class="control-group">        
            <label class="control-label" for="title">Title</label>
            <div class="controls">
                <select id="title" runat="server">
                    <option>Mr</option>
                    <option>Ms</option>
                    <option>Miss</option>
                    <option>Mrs</option>
                </select>
            </div>
        </div>
        <div class="control-group">        
            <label class="control-label" for="name">Name</label>
            <div class="controls">
                <input runat="server" type="text" id="name" />
            </div>
        </div>
         <div class="control-group">        
            <label class="control-label" for="email">Email</label>
            <div class="controls">
                <input id="email" runat="server" type="text" />
            </div>
        </div>
         <div class="control-group">        
            <label class="control-label" for="enquiry">Enquiry</label>
            <div class="controls">
                <textarea id="enquiry" runat="server" type="text"></textarea>
            </div>
        </div>
        <div class="submitButton">
            <input id="submitForm" type="submit" value="Submit" runat="server" onserverclick="submitData">
            <div class="clear"></div>
        </div>

    </div>
</div>

Now, I had a look around the net, and found an interesting tutorial - not tested - http://www.mikesdotnetting.com/article/41/send-form-content-by-email-in-asp-net which I was planning to try. There is one thing though, he uses this script:

using (MailMessage message = new MailMessage())
{  
  message.From = new MailAddress(YourEmail.Text.ToString());  
  message.To.Add(new MailAddress("me@domain.com"));  
  message.CC.Add(new MailAddress("copy@domain.com"));  
  message.Subject = "Message via My Site from " + YourName.Text.ToString();  
  message.Body = Comments.Text.ToString();  
  SmtpClient client = new SmtpClient();  
  client.Host = "127.0.0.1";  
  client.Send(message);    
}

and I'm not sure where to get the values for the below, as I'm developing from localhost

message.To.Add(new MailAddress(""));  
message.CC.Add(new MailAddress(""));  
client.Host = "";

Any idea?
EDIT: I mean, does is make any difference what email provider I'm trying to forward the email to, or is it irrelevant? I'd like it to go to a gmail address

Violet_82 89 Posting Whiz in Training

Oh I see, so that "as" is effectively a cast operator. OK I think it's all clear!! thanks for your help

Violet_82 89 Posting Whiz in Training

Yes, I must admit I have problems understanding your description. However, how are you measuring the width? are you considering scroll bars if any?

Violet_82 89 Posting Whiz in Training

Sorry to batter in, can you not use the height applied to the list item instead, rather than messing around with the line-height?

Violet_82 89 Posting Whiz in Training

Have you tried adding a min-width and not using the 'screen'?
I usually borrow my breaking points from the old bootstrap:

/*Tablets*/ @media (min-width:768px) and (max-width:1023px){}
/*Mobiles*/@media (max-width:767px){}

and they've always worked a treat

Violet_82 89 Posting Whiz in Training

OK that's working, thanks pritaeas. I have some questions though, lol, sorry!
With the code you posted above you are essentially testing whether a master page exists already (and we know it does because it's Site.master), and if there is, that (Master as Site) (which presumably is a 'synonym' of the master page) is used to call the function in the master page. Now, I didn't see this stuff in my master page tutorial, do you know any resource where I can read about this Master property and how it is used (that's because this syntax is a bit new to me, I mean the if statement doesn't even have curly brackets!!??)

Also, one more thing: in the main function

public void ActiveClass(string whatPage) {
        string PageName = whatPage;
        switch (PageName) {
        case "HomeLink":
        HomeLink.CssClass = "active";
        break;
        case "AboutLink":
        AboutLink.CssClass = "active";
        break;
        case "OPLink":
        OPLink.CssClass = "active";
        break;
        }
    }

I set the class to change to active when the value of the variable changes, but I'm not resetting the class to " ", as in, shouldn't be more correct to say

public void ActiveClass(string whatPage) {
        string PageName = whatPage;
        switch (PageName) {

        case "HomeLink":            
        HomeLink.CssClass = "active";
        AboutLink.CssClass = "";
        OPLink.CssClass = "";
        break;

        case "AboutLink":
        AboutLink.CssClass = "active";
        HomeLink.CssClass = "";
        OPLink.CssClass = "";
        break;

        case "OPLink":
        OPLink.CssClass = "active";
        AboutLink.CssClass = "";
        HomeLink.CssClass = "";
        break;
        }
    }

If it works without the above amendments, I take that it is taken …