DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 30 Jul 2007 21:07:30 -0400,    posted on: microsoft.public.dotnet.framework.aspnet.webcontrols        back       

Thread Index
  1    Nathan Sokalski
          2    chenhong
          3    chenhong
          4    chenhong
          5    Teemu Keiski
          6    Teemu Keiski
          7    Teemu Keiski
          8    Teemu Keiski
          9    Teemu Keiski
          10    Teemu Keiski


Problem with ImageButton.OnClientClick when DataBinding   
I have the following tag in one of my DataList's ItemTemplates:

<asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
OnClientClick="window.open(<%# 
DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
%>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>

As you can see, my goal is to use the value from the DataBinding Expression 
as the first parameter of a JavaScript window.open() method in the 
OnClientClick property of an ImageButton. However, when I run the 
application using this, I recieve the following error:

Server Error in '/' Application.
--------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to 
service this request. Please review the following specific parse error 
details and modify your source file appropriately.

Parser Error Message: The server tag is not well formed.


I tried to be careful using the single and double quotes, but I think 
everything is correct. Did I do something wrong in this server tag? All my 
other DataBinding Expressions work fine when I remove this tag, and the 
error says the problem is in this line, so what's the problem? Thanks.
-- 
Nathan Sokalski
njsokalski@hotmail.com
http://www.nathansokalski.com/
Date:Mon, 30 Jul 2007 21:07:30 -0400   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
OnClientClick isn't a bindable property.
you should build OnClientClick string in ImageButton's load event.
Hope this will help.


"Nathan Sokalski"  дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...

>I have the following tag in one of my DataList's ItemTemplates:
>
> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
> OnClientClick="window.open(<%# 
> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>
> As you can see, my goal is to use the value from the DataBinding 
> Expression as the first parameter of a JavaScript window.open() method in 
> the OnClientClick property of an ImageButton. However, when I run the 
> application using this, I recieve the following error:
>
> Server Error in '/' Application.
> --------------------------------------------------------------------------------
>
> Parser Error
> Description: An error occurred during the parsing of a resource required 
> to service this request. Please review the following specific parse error 
> details and modify your source file appropriately.
>
> Parser Error Message: The server tag is not well formed.
>
>
> I tried to be careful using the single and double quotes, but I think 
> everything is correct. Did I do something wrong in this server tag? All my 
> other DataBinding Expressions work fine when I remove this tag, and the 
> error says the problem is in this line, so what's the problem? Thanks.
> -- 
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
> 
Date:Tue, 31 Jul 2007 12:43:50 +0800   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
OnClientClick isn't a bindable property.
you should build OnClientClick string in ImageButton's load event.
Hope this will help.


"Nathan Sokalski"  дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...

>I have the following tag in one of my DataList's ItemTemplates:
>
> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
> OnClientClick="window.open(<%# 
> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>
> As you can see, my goal is to use the value from the DataBinding 
> Expression as the first parameter of a JavaScript window.open() method in 
> the OnClientClick property of an ImageButton. However, when I run the 
> application using this, I recieve the following error:
>
> Server Error in '/' Application.
> --------------------------------------------------------------------------------
>
> Parser Error
> Description: An error occurred during the parsing of a resource required 
> to service this request. Please review the following specific parse error 
> details and modify your source file appropriately.
>
> Parser Error Message: The server tag is not well formed.
>
>
> I tried to be careful using the single and double quotes, but I think 
> everything is correct. Did I do something wrong in this server tag? All my 
> other DataBinding Expressions work fine when I remove this tag, and the 
> error says the problem is in this line, so what's the problem? Thanks.
> -- 
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
> 
Date:Tue, 31 Jul 2007 12:43:50 +0800   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
OnClientClick isn't a bindable property.
you should build OnClientClick string in ImageButton's load event.
Hope this will help.


"Nathan Sokalski"  дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...

>I have the following tag in one of my DataList's ItemTemplates:
>
> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
> OnClientClick="window.open(<%# 
> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>
> As you can see, my goal is to use the value from the DataBinding 
> Expression as the first parameter of a JavaScript window.open() method in 
> the OnClientClick property of an ImageButton. However, when I run the 
> application using this, I recieve the following error:
>
> Server Error in '/' Application.
> --------------------------------------------------------------------------------
>
> Parser Error
> Description: An error occurred during the parsing of a resource required 
> to service this request. Please review the following specific parse error 
> details and modify your source file appropriately.
>
> Parser Error Message: The server tag is not well formed.
>
>
> I tried to be careful using the single and double quotes, but I think 
> everything is correct. Did I do something wrong in this server tag? All my 
> other DataBinding Expressions work fine when I remove this tag, and the 
> error says the problem is in this line, so what's the problem? Thanks.
> -- 
> Nathan Sokalski
> njsokalski@hotmail.com
> http://www.nathansokalski.com/
> 
Date:Tue, 31 Jul 2007 12:43:50 +0800   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
I agree that its most flexible to do in code, but OnClientClixk can be 
databound

  <asp:DataGrid ID="DataGrid1" runat="server" GridLines="Both" 
BorderWidth="0" AutoGenerateColumns="false">
            <Columns>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" 
OnClientClick='<%# "alert(""" & Cstr(Container.DataItem) & """);return 
false;" %>' />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
Handles Me.Load
        Dim ints As New List(Of Integer)
        ints.Add(1)
        ints.Add(2)
        ints.Add(3)

        DataGrid1.DataSource = ints
        DataGrid1.DataBind()
    End Sub

This would alert the integer value on Button click


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:42:06 +0300   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
I agree that its most flexible to do in code, but OnClientClixk can be 
databound

  <asp:DataGrid ID="DataGrid1" runat="server" GridLines="Both" 
BorderWidth="0" AutoGenerateColumns="false">
            <Columns>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" 
OnClientClick='<%# "alert(""" & Cstr(Container.DataItem) & """);return 
false;" %>' />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
Handles Me.Load
        Dim ints As New List(Of Integer)
        ints.Add(1)
        ints.Add(2)
        ints.Add(3)

        DataGrid1.DataSource = ints
        DataGrid1.DataBind()
    End Sub

This would alert the integer value on Button click


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:42:06 +0300   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
To add, the trick is that the databinding expression should span the entire 
property e.g "cover" it. That way it works. However, complex kind of script 
is best to build in code. With a helper function for example.


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:44:05 +0300   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
I agree that its most flexible to do in code, but OnClientClixk can be 
databound

  <asp:DataGrid ID="DataGrid1" runat="server" GridLines="Both" 
BorderWidth="0" AutoGenerateColumns="false">
            <Columns>
                <asp:TemplateColumn>
                    <ItemTemplate>
                        <asp:Button ID="Button1" runat="server" 
OnClientClick='<%# "alert(""" & Cstr(Container.DataItem) & """);return 
false;" %>' />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) 
Handles Me.Load
        Dim ints As New List(Of Integer)
        ints.Add(1)
        ints.Add(2)
        ints.Add(3)

        DataGrid1.DataSource = ints
        DataGrid1.DataBind()
    End Sub

This would alert the integer value on Button click


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:42:06 +0300   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
To add, the trick is that the databinding expression should span the entire 
property e.g "cover" it. That way it works. However, complex kind of script 
is best to build in code. With a helper function for example.


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:44:05 +0300   Author:  

Re: Problem with ImageButton.OnClientClick when DataBinding   
To add, the trick is that the databinding expression should span the entire 
property e.g "cover" it. That way it works. However, complex kind of script 
is best to build in code. With a helper function for example.


-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"chenhong"  wrote in message 
news:%23I3Hl1y0HHA.4712@TK2MSFTNGP04.phx.gbl...

> OnClientClick isn't a bindable property.
> you should build OnClientClick string in ImageButton's load event.
> Hope this will help.
>
>
> "Nathan Sokalski"  
> дϢ:uJh2l8w0HHA.4712@TK2MSFTNGP04.phx.gbl...
>>I have the following tag in one of my DataList's ItemTemplates:
>>
>> <asp:ImageButton ID="btnViewQuestion" runat="server" BorderWidth="0" 
>> ImageUrl="images/qmark.gif" Height="27px" Width="26px" 
>> OnClientClick="window.open(<%# 
>> DataBinder.Eval(Container.DataItem,"questionid","'viewquestion.aspx?questionid={0}'") 
>> %>,'question','scrollbars=yes,width=630,height=480,location=no,menubar=no,status=no,toolbar=no');"/>
>>
>> As you can see, my goal is to use the value from the DataBinding 
>> Expression as the first parameter of a JavaScript window.open() method in 
>> the OnClientClick property of an ImageButton. However, when I run the 
>> application using this, I recieve the following error:
>>
>> Server Error in '/' Application.
>> --------------------------------------------------------------------------------
>>
>> Parser Error
>> Description: An error occurred during the parsing of a resource required 
>> to service this request. Please review the following specific parse error 
>> details and modify your source file appropriately.
>>
>> Parser Error Message: The server tag is not well formed.
>>
>>
>> I tried to be careful using the single and double quotes, but I think 
>> everything is correct. Did I do something wrong in this server tag? All 
>> my other DataBinding Expressions work fine when I remove this tag, and 
>> the error says the problem is in this line, so what's the problem? 
>> Thanks.
>> -- 
>> Nathan Sokalski
>> njsokalski@hotmail.com
>> http://www.nathansokalski.com/
>>
>
> 
Date:Wed, 1 Aug 2007 20:44:05 +0300   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us