1
我有2個asp列表框控件和一個html輸入按鈕,並使用JS我添加項目(以前從DB加載項目)從列表框A到B,它工作正常,但是當我提交表單,在列表框B後面的代碼中沒有添加可訪問的項目。listbox和javascript添加項目
我的想法是試圖保存往返服務器,並在客戶端,但看起來不起作用。
任何想法?
非常感謝你的時間!
編輯
有代碼
<asp:ListBox ID="lstBoxOrgs" runat="server" Height="117px" Width="502px" SelectionMode="Multiple"></asp:ListBox>
<input type="button" value="Add" onclick="AddItems2Listbox('lstBoxOrgs', 'lstBoxUserRelOrgs') "/>
後面的代碼:
protected void AssignOrgs_Click(object sender, EventArgs e)
{
foreach (ListItem orgItem in lstBoxUserRelOrgs.Items)
{
//Update database here...
}
//Commit updates to DB
cdc.SubmitChanges();
}
的onclick="AddItems2Listbox('lstBoxOrgs', 'lstBoxUserRelOrgs')
是,其將從lisbox A中的項目列表框B. JavaScript函數
Th anks
請添加您的代碼(或簡單的例子),然後我們更容易幫助您。 – 2009-10-27 10:00:12