Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreDispay image from the Image type image from the databaseDispay image from the Image type image from the database
Previous
 
Next
New Post
9/23/2009 9:49 AM
 

Hi Prasad,

NO NO NO, the blog post from Benoît and I is about how to create a NEW module from scratch, not to modify the Store module! You have to read this post and follow exactly my advices. THIS IS REALY IMPORTANT or I can't help. Remember you told me your are a beginner with ASP.NET, DotNetNuke and module dev. I understand that your are tired, but if you do not follow my advices what can I do?

Gilles


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
New Post
9/23/2009 12:17 PM
 

Hi Gilles,

I think I have done exactly what you have mentioned in your post. I will go throgh it again. By the way I am using DNN 5 and Store 2.2 version. wil it be an issue for this? I am not a beginer to the development.But this is the first time I am going to modify Store module. I have developed new templates.But now I want to add new token. I beleve my code is correct. But my changes are not applying. is this issue with new versions? I will try again.

Thanks.

 

 
New Post
9/24/2009 8:52 AM
 

Hi Gilles,

Finally I got the solution.Now my project is compiling and applying my changes in to the .dlls.
Thank you very very much for your genuine support.Really you and Benoit helped me a lot.


Actually I wanted to do this. I have to work some other database and they are saving images in to the database in image format as byte data. I have to read it and show it as an image. They are updating my DNN database.But Images are in image format. Then I have to read that byte data and have to show it as an image. Anyway I created a token and try to show it as a image control in ProductDetails page according to your (Gilles) instructions. I tested a new token with text control and It is working.But I can not do it for the image control.

I did my changes in DotNetNuke.Store.WebControls project and ProductDetail.ascx.cs page under this code.

private Control processToken(string tokenName)
        {
            switch (tokenName)
            {
                case "IMAGE":


This is what I have added as my new method.But there is an issue with the Image type what I have used.This is my code.

case "IMAGEDB":
                    //Label lbltest = new Label();
                    //lbltest.Text =  Localization.GetString("test.Test", this.LocalResourceFile);
                    ////lbltest.Text = string.format(Localization.GetString("WidthText", this.LocalResourceFile), productInfo.ProductWidth.ToString(Localization.GetString("Widthformat", this.LocalResourceFile), Localformat));
                    //lbltest.CssClass = "StoreCategoryName";
                    //return lbltest;
                    byte[] img;
                     Image returnImage;
                    if (!showThumbnail || String.IsNullOrEmpty(productInfo.ProductImage))
                    {
                        // No control in this case
                        return null;
                    }
                    else
                    {
                        string imageAlt = productInfo.Summary;
                        if (imageAlt == string.Empty)
                            imageAlt = Localization.GetString("ImageAlt.Text", LocalResourceFile);
                       
                        //get the image id from the url
                        string ImageId = Request.QueryString["img"];

                        //build our query statement
                        string sqlText = "SELECT img_data, img_contenttype FROM Image WHERE img_pk = 1";

                        SqlConnection connection = new SqlConnection(ConfigurationSettings.AppSettings["TestingSiteSqlServer"].ToString());
                        SqlCommand command = new SqlCommand(sqlText, connection);

                        //open the database and get a datareader
                        connection.Open();
                        SqlDataReader dr = command.ExecuteReader();
                        if (dr.Read()) //yup we found our image
                        {
                            Response.ContentType = dr["img_contenttype"].ToString();
                            Response.BinaryWrite((byte[])dr["img_data"]);

                            img = (byte[])dr["img_data"];

                            MemoryStream ms = new MemoryStream(img);
                            returnImage =  Image.FromStream(ms);
                        }
                        return returnImage;
                        connection.Close();

                        if (InList)
                        {
                            StringDictionary replacements2 = new StringDictionary();
                            replacements2.Add("ProductID", productInfo.ProductID.ToString());

                            HyperLink lnkImage = new HyperLink();
                            lnkImage.NavigateUrl = catalogNav.GetNavigationUrl(replacements2, detailID);
                            lnkImage.ToolTip = imageAlt;
                            lnkImage.CssClass = "StoreProductLinkImage";
                            lnkImage.Controls.Add(returnImage);
                            return lnkImage;
                        }
                        else
                        {
                            return returnImage;
                        }
                    }


My problem with Image.FromStream . It is not supporting inside the code.

I know you are very busy with your works. I am really sorry If I am disturbing you. If it is possible to help me please let me know what I have done wrong or have I done it in correct way. I am really appreciate what you have done for the community up to now.

Thank you very much.

 
New Post
9/24/2009 1:12 PM
 

 

Hi,
 
 I've mentioned below my problems. Now it has fixed the Application compiling issue .
 
1) There is an existing offline shopping mill with their own system with their database. Now the requirement is I should use that database with their data. They are going to push their data to my database. I studied both our DNN DB and their DB. Both are same but Fields are different. Anyway they agreed to update my database and I do not need to worry about it. I should publish a web service for order details table and already I created a DNN module with that web service to put anywhere in the Database. But there is a one problem. They are saving product images to the database in Image format. Not to a folder. 
 
 
2) I have done some changes to get my result and try to run again. Then application crashed and now It is showing Application is unavailable message. Then I have to re - try it with new fresh  copy. I refreshed the site and it just went to upgrade to new version and upgraded to DNN 5 version. If you know any reason for this please let me know. Anyway I will try with new copy.
 
3) When I install the DNN copy always I am getting this error.
 
Parser Error Message: The entry 'ScriptModule' has already been added.
 
There are some solutions in the web. But It seems not solving it 100% .Please let me know is this normal? Then what is the correct way to get rid to this error.
 
4) I worked with DNN 4.9 and Store 2.1 .Both was worked perfectly. I know there are some additional features in the DNN 5 and Store 2.2. Please tell me shall I use those new versions to my production environment. Is this the correct time to use it? I know you always advice us not to use beta versions. But it has some new features like stock management and really important. Please tell me what do you think?
 
5) When I run the source without debugging the project is running on my browser. But it is not allowing to add/Edit/Delete Pages. Links are not working in the op admin bar. Then I opened it as a normal web site in another VS Window. Then it worked. Tell me why this happening is. Did I do it incorrectly? Sometimes it might be the reason to crash my previous project. If you can, please advise me to this.
 
 
Thank you very much for your support and advices.
 
 
New Post
9/25/2009 11:19 AM
 

Hi Prasad,

1) I have already explained that you have to create your own token and to create a new page like ImageDB.aspx to replace the Thumbnail.aspx page. Your code to read the image from the db should be in the ImageDB.aspx page NOT in the ProductDetail.cs! Look at the IMAGE token to discover how it work. Basicaly the token return an image control with an url like http://yourdomain/DesktopModules/Store/Thumbnail.aspx?IP=(image path)&IW=(imagewidth)&portalID=(your portal ID). When the page is displayed, the client browser call this url to retreive the image. You have to create your own url to call your ImageDB.aspx page with your own parameters. Moreover, you have to understand that I CAN'T write your own code because it's higly time consuming and too specific to your needs. Please stop to use my email to request support, I do not offer this kind of personal support for free because it's NOT related to the Store module but to YOUR needs.

2 and 3) For questions related to dnn, please ask in the "Install It!" forum.

4) There is NO version 02.02.00! The last beta version is 02.01.17. Some users have installed the beta on production, but I can't give you any garanty about the beta versions.

5) It's normal! You can't use the "Edit & Continue" method because the solution use the WAP model not the WSP model. You should read this "Introduction to Web Application Projects" at MSND to understand what a WAP project is. There are plentry of posts on the Internet too, like this one.

Gilles


We (team members) are Humans offering their knowledge, their work and their spare time FOR FREE to benefit the community. It would be so particularly appreciated that your messages begin with "Hello" and end with "Thank you" or any other form of politeness. Ask yourself what your reaction would be, if you were approached by me (a total stranger) on the street to ask you something without saying "Hello" nor "Thank you"? After several years of services dedicated to the community, I begin to be tired to read requests without any form of politeness.
 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsStoreStoreDispay image from the Image type image from the databaseDispay image from the Image type image from the database


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out