Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following code if the image button is not inside an update panel it works. If it is kept
inside update panel to avoid page refresh purpose it throws an error like:does not contain a definition for DataItem and no extension method DataItem accepting a first argument of type System.Web.UI.Control could be found (are you missing a using directive or an assembly reference?)


XML
<asp:UpdatePanel ID="popp" runat="server" >
    <ContentTemplate>
    <asp:ImageButton ID="ImageButton1" Height="200px" Width="254px"  runat="server" CommandName="myeventDetails"  ImageUrl='<%#DataBinder.Eval(Container.DataItem,"PicturePath") %>' />
 </ContentTemplate>
 </asp:UpdatePanel>
Posted
Comments
Aravindba 28-Feb-14 3:38am    
if it is inside update panel imageurl not bind dataitem,so it show error,try to avoid update panel,

1 solution

Try and register your imagebutton for full postback


C#
ScriptManager.GetCurrent(this.Page).RegisterPostBackControl(btnid);
 
Share this answer
 
Comments
Aravindba 28-Feb-14 3:39am    
yes can use,but it refresh the page,but he want without page reload......
S.Rajendran from Coimbatore 28-Feb-14 3:53am    
this is a content page
ravikhoda 28-Feb-14 3:58am    
is this problem for all browser ?
S.Rajendran from Coimbatore 28-Feb-14 11:23am    
is it a bug..no one is answering!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900