Posts Tagged ‘.NET Languages .NET Valley Architecture Design Patterns and Testing ASP.NET ASP.NET and ASP.NET MVC ASP.NET MVC ASP.NET.NET Books Browsers Business Community News Conference Content Management Server ’

解決ASP.NET的HyperLink使用window.open會出現[object]或[object Window]的問題


2010
04.13

小弟最近遇到了此問題..去網路上找了一下資料..分享給大家呀..

一般在.aspx網頁上加入一個HyperLink控制項

並且設定NavigateUrl為”javascript:window.open(‘http://www.dotblogs.com.tw/puma/’)”

在IE,FF都會開新視窗,但本身視窗會出現[object]or[object Window]的訊息

要解決這個問題,只要在多一個”void”,如下所示,就可以解決了…

“javascript:void window.open(‘http://www.dotblogs.com.tw/puma/’)”

Share

Filter A GridView After The Initial Bind


2010
04.13

Filter A GridView After The Initial Bind

One of the goals that Microsoft has really pushed for in ASP.NET 2.0 is saving the amount of coding necessary to perform common tasks such as data access. On a recent project, I needed the ability to filter the results on a GridView control after I returned the results from my datasource. To accomplish this, I added a DropDownList and set the AutoPostBack property on the DropDownList to True. I added two values to the list; one that showed all of the results, and one that showed the filtered result set which in my case was a list of exceptions. I also added a SqlDataSource object called MySqlDataSource. I set the OnChange event to a subroutine similar to below:

Private Sub FilterDropDownList_Change(s as Object, e as EventArgs)
If FilterDropDownList.SelectedValue = “Filter” then
MySqlDataSource.FilterExpression = “MyColumn=1″
Else
MySqlDataSource.FilterExpression = “”
End If

MyGridView.DataBind
End Sub

I added the sub MyGridView.DataBind to the subroutine because this subroutine occurs after the SqlDataSource object is created and the resultset is filled. In reality, you only need to perform the MyGridView.DataBind when the FilterExpression value is set to something other than “”.

From

http://weblogs.asp.net/jgaylord/archive/2006/05/31/Filter-A-GridView-After-The-Initial-Bind.aspx

Share