sql server - Send an email on drop down value changed using asp.net c# -
sql server - Send an email on drop down value changed using asp.net c# -
i trying link email address corresponds name in dropdownlist on website works kinda helpdesk. example, if selected "john" john should receive 'notification' mail service saying ticket has been logged. however, works, looking piece of code or tutorial links email address name in ddlist.
i working vs2012, sql server , it's on normal webform not mvc application.
can help tutorial maybe?
thanks in advance
let's take simple illustration have details like:
name email ------------------------- a@a.com b b@b.com c c@c.com
now bind dropdown , set name text field , email valuefield. here displaying static dropdown , guess want send email when value dropdown changed.
so in aspx page:
<asp:dropdownlist runat="server" id="ddlstaff" onselectedindexchanged="ddlstaff_onselectedindexchanged" autopostback="true"> <items> <asp:listitem selected="true" text="--select--"></asp:listitem> <asp:listitem text="a" value="a@a.com"></asp:listitem> <asp:listitem text="b" value="b@b.com"></asp:listitem> <asp:listitem text="c" value="c@c.com"></asp:listitem> </items> </asp:dropdownlist>
and code behind be:
protected void ddlstaff_onselectedindexchanged(object sender, eventargs e) { if (!string.isnullorempty(this.ddlstaff.selectedvalue)) { var emailaddress = this.ddlstaff.selectedvalue; // code send email } }
reference:
how bind dropdown list database in asp.net c# how send email in asp.net c# asp.net sql-server visual-studio-2012 webforms
Comments
Post a Comment