我有一个事件DropDownList
的方法OnSelectedIndexChanged
改变了一个标签的内容。它工作正常,除了DropDownList
. 有任何想法吗?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Newsletter.DAL;
using Newsletter.Services;
public partial class Senders : System.Web.UI.Page
{
private SenderService _client;
private List<Sender> _allSenders;
private DropDownList _dropDownListSenders;
private TextBox _emailBox;
private string _selectedSender;
protected void Page_Load(object sender, EventArgs e)
{
_client = new SenderService();
_allSenders = _client.GetAllSenders();
_dropDownListSenders = (DropDownList)loginViewMain.FindControl("DropDownListSenders");
_emailBox = (TextBox)loginViewMain.FindControl("textBoxEmail");
}
protected void DropDownListSenders_SelectedIndexChanged(object sender, EventArgs e)
{
_selectedSender = _dropDownListSenders.SelectedValue;
_emailBox.Text = _selectedSender;
}
}