locked
Datalist Rows / Columns RRS feed

  • Question

  • User-1585994330 posted

    This might be a very "newbie" question but...

     Is there a way of limiting the amount of items in a datalise, or enableing a "paging" type function like in gridview?

    I am attempting to create a photo album where you click the mina image of the album, it takes you to the page of the album, and loads the first 20 pictures say, if there is 21 images in the album it`ll give you a page option at the bottom, if any one is familiar with "Facebooks" layout for photo albums thats really what im going for.

    Currently i have worked out how to limit the number of Repeat columns, but is there a way of limiting Rows as well as how to enable a "paging" type function in datalist.

    If there is a way of doing this in Gridview or some other way i have over looked any suggestions are appriciated. Thanks in advance. si!
     

    Sunday, May 27, 2007 1:15 PM

Answers

  • User1742304165 posted

    For your forum question, if I were you, I would look into a cool control called freetextbox.  It is a wysiwyg editor for asp.net applications and I think that would be just what you are looking for per your question in regards to formatting text.

    As for cuppedwing.net, it was written totally from scratch and it was my first real .NET Web Application playing around with memberhships and roles.   Threre is alot yet to do with it but you can definateley play around with it.  I am using aspjpeg for the thumbnailer but just haven't got around to programming my own.  Yeh, you can shoot me your info on joshuafolkerts.com or whatever.  Let me know.

    Joshua

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 29, 2007 1:02 PM

All replies

  • User1742304165 posted

    This should do what you are looking for.

    http://www.codeproject.com/aspnet/paging.asp

     joshua

    Sunday, May 27, 2007 2:40 PM
  • User-1585994330 posted

     Thanks that looks spot on ill give it a go [:D]

    Sunday, May 27, 2007 6:21 PM
  • User-1585994330 posted

    Thanks that really did the trick, but a new question has come out of the example code on that site.

    The image resizeing is done by a class and a Handler.ashx, can anyone explain how that works? or an alternative, cos I dont have class info / profiles set up as i am using Forms Authentication.

    thanks in advance. Si! 

    Monday, May 28, 2007 9:16 AM
  • User1742304165 posted

    good morning,

    You say that you are using form authentification correct?  If you are using the the personal web site from asp.net, then you are using forms authentification.   That the handler does is, when Hander.ashx is called, it calls the database and grabs the binary data and renders it to the output of the page, hense the image, then setting it to a class for the what type of thumbnail it is looking to render as.  Catch my drift.  there are a number of ways to do it without the handler but I think yoiu are going to want to stick to using the handler.  If you want to keep your images stored on the filesystems, then the handler will not be needed but you are going to want to make sure that you set up some form of thumbnailing to reduce the over all size when the client views the page. 

    Any other questions?, don't hesitate or feel ashamed to ask.....  We are all here to learn.

    Joshua

    Monday, May 28, 2007 9:54 AM
  • User-1585994330 posted

    Thanks that makes sense, the problem ive got is at the moment i upload the images URL to the database, not the image, how would i go about making it upload the image? It (in my head) only makes sense to upload the image to the database not the url, but i do not know how to do that as yet.

    Im not using the personal website from asp.net, where can i get that? and is it free-to-use? In the long run i would want to publish this website for use. Does the personal website from asp.net allow this?

    The stuff i am using in forms authenticate is just log on and off, and im attempting roles (but currently that doesnt work lol) I learn all i know about it from the book "Pro ASP.NET with C#".

    The code in this example is very useful and seems the best method for manageing and uploading images and creating albums, im just new to the whole upoading images to a database and manipulating images. So your help is greatly appriciated.

    Si! 

    Monday, May 28, 2007 10:15 AM
  • User1742304165 posted

    Here is the link to the personal website starter kit.  It is free and ready for use.  follow instructions though but it can pretty much anything you want.  It uploads images into the database and all the thumbnailing for you.  here is the link www.joshuafolkerts.com.  if you want to see a mocked up version, you can check my site out and it is based on the starter kit.  Jeremy wadsworth has is own mock up of the pws and you might find that useful as well.  here is the link and you can check it out.

    http://www.asp.net/downloads/starterkits/PersonalSite.aspx?tabid=62

    enjoy.

    Joshua

    Monday, May 28, 2007 12:11 PM
  • User-1585994330 posted

     Thanks alot, that should really help, one more question which will cause me problems.

    I am using the AJAX slideshow extender  to show a slideshow of images with captions from my database, will this go completely wrong when i upload the actual image or will it jus sync nicely?

     

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Data.SqlClient;


    public partial class Default4 : System.Web.UI.Page
    {
        string QueryStringID;
        private static DataTable tblData = new DataTable();

        protected void Page_Load(object sender, EventArgs e)
        {
            QueryStringID = Request.QueryString["id"];
            if (this.IsPostBack)
                return;

            string strSQL = "SELECT PhotoID, Caption, PhotoURL, ImageWidth, ImageHeight  FROM LandlordPhotos WHERE PropertyID = @PropID";
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["BlinkConnectionString"].ConnectionString);
            conn.Open();
           
            SqlCommand comm = new SqlCommand(strSQL, conn);
            comm.Parameters.Add("@PropID", SqlDbType.VarChar).Value = QueryStringID;
          
            SqlDataAdapter da = new SqlDataAdapter(comm);
            tblData = new DataTable();
            da.Fill(tblData);
            conn.Close();

            // set the initial image
            if (tblData.Rows.Count > 0)
            {
                imgShowImage.ImageUrl = "PictureThis/Landlords/" + tblData.Rows[0]["PhotoURL"].ToString();
                imgShowImage.Width = tblData.Rows[0]["ImageWidth"].ToString();
                imgShowImage.Height = tblData.Rows[0]["ImageHeight"].ToString();
            }
        }

        [System.Web.Services.WebMethod]
        [System.Web.Script.Services.ScriptMethod]
        public static AjaxControlToolkit.Slide[] GetSlides()
        {
            AjaxControlToolkit.Slide[] slides = new AjaxControlToolkit.Slide[tblData.Rows.Count];
     
            for (int i = 0; i < tblData.Rows.Count; i++)
            {
                DataRow dr = tblData.Rows[i];
                slides[i] = new AjaxControlToolkit.Slide(
                    "PictureThis/Landlords/" + dr["PhotoURL"].ToString(),
                    dr["PhotoID"].ToString(),
                    dr["Caption"].ToString());
            }
            return slides;
        }
    }

     

    thanks again, and sorry to ask soo many questions Si! 

    Monday, May 28, 2007 12:20 PM
  • User1742304165 posted

    No problem on the questions, that is how we learn, But looking at your code, you are going to run into alot of problems since your code is based on file system path.  you can do away with that and use the pws and incorperate the ajax slider into it.  all you will need to do is use the handler.ashx to render each photo " so instead of dr["photoURL"].tostring(0);  you would do something like( this is a basic you are going to have to drill down int your ajax control but something like this    slides[i]=new ajaxcontroltoolkit.slide(handler.ashx?xxxxxxx).  catch my drift.

    Hope this helps.

    Joshua

    Monday, May 28, 2007 1:36 PM
  • User-1585994330 posted

    Ive been playing around with the microsofts code for the photo album basic kit, im tryin to have the "albums" page to specific to the individual user, which is harder said that done.

    And ive also had a go at , you know the "upload" folder where you can upload all the images in one go, well i was trying to make it so that i can select a folder and upload, but the "FileUpload" browser takes me into the file rather than selecting it. Is there a way around this as well?

    This code is very impressive, and very helpful. Im trying to slowly pick it apart to work out how the drawing of the image  works as well as that interests me greatly. Do you know anywhere on either this website or just a random link that comments the classes, I have started it myself but as I am new to the whole redrawing/ uploading images to a database its taking me ages! Thanks once more. You are being most helpful [:D]

    Monday, May 28, 2007 4:26 PM
  • User-1585994330 posted

    also on a personal note, i had a browse on your site, if i can find somewhere (most likely in the admin part of my site) to use your slider with gridview, im going to if that is ok, im using a lot of AJAX currently to keep the professionalism of the site at its highest, and that item would fit in nicely [:)] 

    Monday, May 28, 2007 4:33 PM
  • User1742304165 posted

    Hey there.

    As far as your questions are concerned, let me see if I can help you.  As far and pointing to a directory and uploading images, I have never done that or came across any code that allows you to do this but I am sure it can be done.  One thing to note that if you do find a way to do that, you are going to run into many problems such as people with large photos inside of he folder and the number of photos that they can upload at one time.  

    As for have specific people have their own galleries, I have created a site like that already that is out on the internet called www.cuppedwings.net check it out and I can send you the code if you want.  I need to incorperate my own thumbnailer in it though.  Right now it is using a third party thumbnailer and it works nice but would like to make it as is, no third party components but it works great.

    Hope this helps.

    Joshua

    Tuesday, May 29, 2007 9:02 AM
  • User-1585994330 posted

    Cuppedwings.net seems like what im going for, did you modify the asp.net starter kit or write it yourself? If you wouldnt mind sending me it that would be ace, im aiming on getting as much knowledge behind me as possible before i really set to development my site.

    What thumbnail system are you using at the moment then? it seems to "load" one how does that work? Yeh i was thinking uploading a directory would be hard, so ive changed my plans slightly, ive discovered that you have a file browser within an asp page like you can exporer all your files / folders and such and select an item and then it`ll display the infomation such as the size / location / type of the file, and iwas going to see how hard it is to modify that to select multiple images to upload. But currently as you can tell im playing around with several codes at once, just to see the limitations of the software.

     Also, if I could bend your ear on anoter  mini code i have been working on. I have made a forum , really basic, but where the replys people enter can contain forum tags such as [i] [/i] for itialics and [b] [/b] for bold, and was working on a way to have it do all that in the "background" like the reply boxes on this forum, currenty i have the buttons set up and clicking them will make the [b] tag for example appear in the textbox, but in this one it doesnt appear, it just sets the preceding text to the set formatting. Any hints/ suggestions with that would be greatly recieved as well.

    How would you send me the code, I dont really want to put my email on this thread, i will send you a private message kool? thanks a bijillion! Si!

    Tuesday, May 29, 2007 11:23 AM
  • User1742304165 posted

    For your forum question, if I were you, I would look into a cool control called freetextbox.  It is a wysiwyg editor for asp.net applications and I think that would be just what you are looking for per your question in regards to formatting text.

    As for cuppedwing.net, it was written totally from scratch and it was my first real .NET Web Application playing around with memberhships and roles.   Threre is alot yet to do with it but you can definateley play around with it.  I am using aspjpeg for the thumbnailer but just haven't got around to programming my own.  Yeh, you can shoot me your info on joshuafolkerts.com or whatever.  Let me know.

    Joshua

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 29, 2007 1:02 PM