You asked for it...
workflow:
I have a page displaying all the details of a certain 'vacature'. The detailsView on that page contains a 'Solliciteer!' hyperlinkField. in the URL this hyperlink generates I also included a query string '?Id={0}' where Id is the Id of the 'vacature'.
Once clicked, people get 'sent' to the 'sollicitatie' page for which I built a (.ascx) control.Most of the fields in this control are textfields and fileUpload fields, which all work.
The only problem I have is that I want to add automatically the 'filiaal' value to the 'sollicitatie' email
In my possible solution (which doesn't work by the way) I used a FormView named 'vacatureFiliaal' to display the 'filiaal' value of that specific 'vacature'
this displaying the 'filiaal'value actually works, but if I want to include this value in an e-mail by:
Code:
mailBody = mailBody.Replace("###VacatureFiliaal###", VacatureFiliaal.SelectedValue)
following your example in chapter 9, page 325, I won't get the 'filiaal' value in the email.
the following code shows you where I create the 'vacatureFiliaal' formView.
Code:
<asp:FormView ID="VacatureFiliaal" runat="server" DataSourceID="SqlDataSource2"
style="font-weight: 700; font-size: large">
<EditItemTemplate>
Filiaal:
<asp:TextBox ID="FiliaalTextBox" runat="server" Text='<%# Bind("Filiaal") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<InsertItemTemplate>
Filiaal:
<asp:TextBox ID="FiliaalTextBox" runat="server" Text='<%# Bind("Filiaal") %>' />
<br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True"
CommandName="Insert" Text="Insert" />
<asp:LinkButton ID="InsertCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</InsertItemTemplate>
<ItemTemplate>
Filiaal:
<asp:Label ID="FiliaalLabel" runat="server" Text='<%# Bind("Filiaal") %>' />
<br />
</ItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>"
SelectCommand="SELECT Filiaal.Filiaal FROM Vacature INNER JOIN Filiaal ON Vacature.FiliaalId = Filiaal.Id WHERE (Vacature.Id = @Id)">
<SelectParameters>
<asp:QueryStringParameter Name="Id" QueryStringField="Id" />
</SelectParameters>
</asp:SqlDataSource>