foreign key value and BinaryImage in Grid

2 posts, 1 answers
  1. Derek
    Derek avatar
    119 posts
    Member since:
    Oct 2008

    Posted 07 Jul 2009 Link to this post

    I have a RadGrid that I am using for website users to upload photos and related information.I am using Asp.Net membership services to identify users, and have the database configured to use the UserID (a GUID value) as the foreign key so that uploaded photos are tied to the user who uploaded them.

    The grid is working without the foreign key, images being uploaded and displaying, but I have two issues/questions.

    (1) When the user edits an image, if the image (or another image) is not selected in the GridBinaryImageColumn then the existing image is deleted (or overwritten with null). What I'd like to have happen is that if no image is selected, I'd like to leave the existing image there.

    (2) On insert, I'd like to have the UserID saved to the appropriate column in the SQL table, but I don't want to display it. Once the user is logged in then the UserID is stored in a session variable, but what I want to do is save the UserID value to the appropriate column on an insert. I don't need to worry about it on an update.

    Thanks in advance for any insight.
  2. Answer
    Georgi Krustev
    Georgi Krustev avatar
    3747 posts

    Posted 10 Jul 2009 Link to this post

    Hello Derek,

    Thank you for contacting us.

    1) Unfortunately the required functionality is not possible with the built-in functionality. If you need to avoid deleting of the image when you update the item, you will need to avoid updating of the concrete field. You will not accomplish this task if you are using automatic operations.

    2) To achieve your goal you will need to handle this functionality all by yourself. You can review this online demo which does not use automatic operations.

    Kind regards,
    Georgi Krustev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top