Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET
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;
        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 20:38pm
Edited 28-Sep-12 20:48pm
Karthik Harve at 29-Sep-12 1:50am
What do you mean by authorised users ?
sasipriyakalpana at 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 at 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 at 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
Please Sign up or sign in to vote.

Solution 1

Replace OnClick to
All the Best
Gopinath Natarajan

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

  Print Answers RSS
0 DamithSL 305
1 OriginalGriff 295
2 Sergey Alexandrovich Kryukov 207
3 Peter Leow 175
4 Afzaal Ahmad Zeeshan 154
0 OriginalGriff 7,460
1 DamithSL 5,519
2 Sergey Alexandrovich Kryukov 4,954
3 Maciej Los 4,936
4 Kornfeld Eliyahu Peter 4,514

Advertise | Privacy | Mobile
Web04 | 2.8.141223.1 | Last Updated 1 Oct 2012
Copyright © CodeProject, 1999-2014
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