I have a button on a page when sends the details to me in an email. This is working fine but i have an issue as one of the questions during my process is a raido button selection. The selected option is working fine on my confirmation page but as its a radio button i'll need an if
statement for my email as one of the id's will be blank.
Does anyone know how i can do this.
Below is the code for my .body
of the email
msg.Body = Label1.Text + " " + Session["pg1input"].ToString()
+ Environment.NewLine.ToString() +
Label2.Text + " " + Session["pg1dd"].ToString()
+ Environment.NewLine.ToString() +
Label3.Text + " " + Session["pg2"].ToString()
+ Environment.NewLine.ToString() +
Label4.Text + " " + Session["pg2Yes"].ToString()
+ Environment.NewLine.ToString() +
Label4.Text + " " + Session["pg2No"].ToString();
From the code above, the following is the radio button row so either 'pg2Yes' will be blank or 'pg2No' will be blank depending on the radio button selected
Label4.Text + " " + Session["pg2Yes"].ToString()
+ Environment.NewLine.ToString() +
Label4.Text + " " + Session["pg2No"].ToString();
Id prefer if i just have one label4 displayed and the radio button selected.
I did try
Label4.Text + " " + Session["pg2Yes"].ToString() + Session["pg2No"].ToString();
But this casued the email not to be sent.
The HTML below is what i have used on the confirmation page to display the relevent radio button selected
<div class="form-group">
<div class="col-xs-12">
<asp:Label ID="Label4" class="col-md-3 control-label" runat="server" Text="Kids?"></asp:Label>
<div class="col-md-3 form-control-static">
<% if (Session["pg2Yes"] == "Yes")
{%>
<%=Session["pg2Yes"] %>
<%}
if (Session["pg2No"] == "No")
{%>
<%=Session["pg2No"] %>
<%} %>
</div>
</div>
</div>