I've created a class library for various custom controls that we use a lot, and it works great. I've gotten pretty comfortable designing the UI and all of that in pure code-behind. My latest control is an image rotator that grabs various information about each image from the EXIF data and displays it. I want to take it to the next level, so that the user can right-click on an image and click a menu item that pops up an edit window and change the EXIF data. I have each individual piece working, but I can't seem to get it to all go together. I have two thoughts on how I could accomplish this.
Is there an option I'm missing? Remember that all of this is getting compiled into a single class-library dll, so there are no designer files, no aspx files, etc. Pure code. Any guidance would be greatly appreciated!
- Use a separate "page" for the edit window (use the NavigateUrl on the RadWindow) and pass the image name on the URL. This is how I would normally do it - use the image name from the querystring to populate the current data, let the user change it, refresh the control on close. The problem with this approach is that I'm completely stuck figuring out how to generate a complete ASP.NET web form entirely in a class - in other words, create a page with the .aspx.cs file and no .aspx file. I can't even seem to get any guidance from Google on this one! I tried to create a class called EditForm.cs that inherits from System.Web.UI.Page and generating the form dynamically, then adding an httpHandler to my web.config to map "editForm.axd" to that class. It all works, but the "page" comes up empty when you to go it. Even if you just go directly to the page (http://localhost/MyNamespace.EditForm.axd), it's completely empty.
- Use a ContentTemplate for the edit window instead. Unfortunately, this approach is nearly undocumented. When I click the RadMenu item, I can get the image name that the user clicked from javascript (by using OnClientItemClicked), but then there's no way to get that back to the RadWindow on the server side. So I tried setting a session variable in the ItemClick server-side event. I'd rather not have to post-back just to get the image name, but it is what it is. The problem with this approach is that I have no idea when to populate my RadWindow based on the data I have. The OnLoad event fires on the main page's Page_Load, so that's not an option. And there doesn't seem to be any kind of an OnShow type event server-side.
Is there an option I'm missing? Remember that all of this is getting compiled into a single class-library dll, so there are no designer files, no aspx files, etc. Pure code. Any guidance would be greatly appreciated!