我已經建立在asp.net C#中的頁面。它擁有單選按鈕的左側和當用戶選擇按鈕中的一個,在相關聯的給該按鈕的右側顯示器數據的內容窗口的列表。我想設置「selectedindex = 0」,以便在頁面加載時用戶看到第一個單選按鈕的內容。單選按鈕,設置第一項爲選擇
在我的代碼的後面,如果我的電臺列表數據綁定方法中設置radioButtonList1.SelectedIndex = 0,則用戶將看到在頁面加載所述第一無線電選擇。但與預先選定的單選按鈕關聯的內容不顯示。我需要在我的內容查看器的數據綁定方法中包含哪些內容才能做到這一點。謝謝!
--------後面的代碼
public partial class test_123 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
radioButtonList1.SelectedIndex = 0
}
protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
}
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
}
您是否嘗試過radioButtonList1.DataBind()? – 2010-11-14 12:28:36
沒有工作,但感謝您的意見。 – PW2 2010-11-14 18:02:06
如果牆壁變得太高而無法爬升,我會採用客戶端解決方案。如果涉及到這一點,讓我知道,我會來一些示例代碼。 – 2010-11-15 08:11:10