GridView에서 편집 된 이메일 행입니다
문제
오후 모두.
라인 당 라인 '피드백'열을 제공하는 그리드 뷰가 있습니다.
업데이트하면 멋진 작은 메시지 상자는 "피드백에 감사드립니다.
이 편집 된 gridview 행을 잡고 이메일 주소로 보내는 방법은 무엇입니까?
AC# .net 초보자에 대한 도움을 주셔서 감사합니다!
해결책 2
나는 실제로 치료를 한 다음과 같이 갔다.
MailMessage feedbackmail = new MailMessage(
"joe.bloggs@joebloggsland.co.uk",
"joe.bloggs@joebloggsland.co.uk",
"Subject",
e.NewValues.Values.ToString());
SmtpClient client = new SmtpClient("SMTP");
try
{
client.Send(feedbackmail);
}
catch (Exception ex)
{
Console.WriteLine("Email unable to be sent at this time", ex.ToString());
}
다른 팁
나는 당신이 그 행에 버튼을 사용하여 피드백을 보내기 위해 명령을 생성하는 데 사용되는 버튼이 있다고 가정합니다. 버튼의 CommandArgument를 "피드백"으로 설정 한 다음 OnrowCommand 이벤트에서 캡처 할 수 있습니다.
페이지의 HTML 측에서 OnrowCommand 이벤트를 추가하십시오.
<asp:GridView ID="GridView1" runat="server" OnRowCommand="myCommand">
</asp:GridView>
그런 다음 다음 코드에 이벤트를 추가하십시오.
protected void myCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandArgument == "feedback")
{
// Grab the row being edited, find the cell/control and get the text
}
}
제휴하지 않습니다 StackOverflow