我需要在ASP.NET網頁(aspx)內創建一個小窗口,當你點擊用戶名時,它顯示用戶名列表,我需要一個新的瀏覽器窗口(不是選項卡)才能打開特定的大小。我可以處理打開新的瀏覽器窗口,假設我用什麼控制我陷入落後的功能,我可以調用代碼....列表超鏈接,按鈕,無論打開新的瀏覽器窗口
string url = "http://www.dotnetcurry.com";
ScriptManager.RegisterStartupScript(this, this.GetType(), "OpenWin", "<script>openNewWin ('" + url + "')</script>", false);
下面是在該鏈接的頁面的標記。
<script language="javascript" type="text/javascript">
function openNewWin(url) {
var x = window.open(url, 'mynewwin', 'width=600,height=600,toolbar=1');
x.focus();
}
</script>
1)我應該使用這個問題是什麼控制,什麼是結構看起來像後,我得到了相應的用戶名從數據庫返回的?
這裏是最接近的我來...這個代碼使用ASP.NET項目符號列表,我試圖綁定到一個HTML鏈接列表,我想反而不是任何地方點,但讓我到代碼隱藏。相反,這段代碼實際上呈現頁面的HTML上(它不會被解析爲超鏈接。)
protected void Page_Load(object sender, EventArgs e)
{
UsersBulletedList.DataSource = theContext.GetOnlineFavorites(4);
UsersBulletedList.DataBind();
}
public IQueryable<String> GetOnlineFavorites(int theUserID)
{
List<String> theUserList = new List<String>();
IQueryable<Favorite> theListOfFavorites= this.ObjectContext.Favorites.Where(f => f.SiteUserID == theUserID);
foreach (Favorite theFavorite in theListOfFavorites)
{
string theUserName = this.ObjectContext.SiteUsers.Where(su => su.SiteUserID == theFavorite.FriendID && su.LoggedIn == true).FirstOrDefault().UserName;
yourOnlineFavorites.Add("<a href='RealTimeConversation.aspx?UserName=" + theUserName + "'>" + theUserName + "</a>");
//this needs to help me get into a codebehind method instead of linking to another page.
}
return yourOnlineFavorites.AsQueryable();
}
Winforms,WPF,web?根據你所描述的,看起來(至少對我來說)datagridview/gridview可能是一個好方法。 – Brian 2013-02-19 17:52:36