Click here to Skip to main content
12,358,497 members (64,375 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,

class.aspx code:

<asp:ImageButton ID="Img1" ImageUrl='<%#Eval("ProductImage") %>' runat="server" Width="30px" Height="30px" OnClick="MakeImgMain" />


class.aspx.cs code:

protected void MakeImgMain(object sender, EventArgs e)
        {
            string ID = ((ImageButton)sender).ID;
            string CLientID = ((ImageButton)sender).ClientID;
            string url = ((ImageButton)sender).ImageUrl;
            ChangeImageOnClick(url);
            UpdatePanel5.Update();
        }
 
        public void ChangeImageOnClick(string url)
        {
            string imageurl = url;
            Image selimg = ((Image)ProdDescDetails.Items[0].FindControl("Prodimage"));
           // selimg.ImageUrl = "";
            selimg.ImageUrl = imageurl;
        }

Onclick event works only for authorized user not for all users.
How to solve this.

Thanks in advance.
Posted 28-Sep-12 19:38pm
Updated 28-Sep-12 19:48pm
v2
Comments
Karthik Harve 29-Sep-12 1:50am
   
What do you mean by authorised users ?
sasipriyakalpana 29-Sep-12 1:55am
   
I am working on Onlinesupermarket project.The products are displayed in default page and when i click on one image it display the selected image details in another page.
when i login to the site then it works but as unkown user it wont display the information.
@AmitGajjar 29-Sep-12 2:35am
   
so what behavior you want ? when user login, site working. and when user not login site should not working. this is correct behavior.
sasipriyakalpana 29-Sep-12 2:47am
   
I want that all users will have to see the products information with login as well as without login.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Replace OnClick to
onclick

All the Best
Gopinath Natarajan
  Permalink  

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


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100