Creating a seperate Edit page

M

MasterChief

I am using Visual Web Developer to create a basic database app. I put
in a grid view and Enabled Selecting on the gridview. What I would like
to happen though is when the person clicks select it opens up a
different EditItems.aspx page with the edit template so the user can
edit the exact item they have selected. I have seen how to do it on one
page but I would really like to keep the Edit Template on a seperate
page.
 
G

Guest

I had a similar problem once. What I did was create a hyperlink to another
..aspx page which was my custom edit form. I rendered the hyperlink with a
unique ID to my database item (ie http://myserver/mypage.aspx?ID=123). I
made this page pop up in a modal window and it works pretty slick. This way
you have complete control over the editing of the item. One drawback is that
the edit page needs to make another trip to the database to get information
about the item based on its ID so it can display itself to the user. Hope
that helps,

Regards,

- Chase
 
M

MasterChief

Thanks for the response. I do have a unique ID for each record. I am
having problems linking though. I could do it fine in ASP but can't
figure it out really in .NET. I chaged the Select button to a template
and made a postback to the edit page. Now in the .aspx code I feel like
I should be adding something but I can't figure out what. What I
thought it might look like is
PostBackUrl="~/EditItem.aspx<% eval('plan_id') %>"

but that doesn't work. Any help would be appreciated.
 
G

Guest

What you are doing looks very familiar, I think I tried that and failed but
never really understood why. What I ended up doing was writing my own
function to return the entire url. Here is my working code:
<ItemTemplate>
<asp:HyperLink Runat=server NavigateUrl='<%#
GetTicketDetailsUrl((int)DataBinder.Eval(Container.DataItem, "OutageID")) %>'
ID="HyperlinkTicketNumber" CssClass="TicketNumber"><%#
DataBinder.Eval(Container.DataItem, "TicketNumber") %>
</asp:HyperLink>
</ItemTemplate>

OutageID is the title of the column in my DataSet that contains the unique
ID of my entry.

and then in my code behind I have the GetTicketDetailsUrl function:
protected string GetTicketDetailsUrl(int outageID)
{
return "javascript:mWin('" + webServerRootUrl + "Details.aspx?ID=" +
outageID.ToString() + "', null,
'height=500,width=500,top=100,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes')";
}

I use javascript in the url because when they click on the link they get a
pop-up type window, but you could easily modify it so that it returns your
url:
return "~/EditItem.aspx?ID=" + outageID.toString();

Hope that helps,

- Chase
 
M

MasterChief

This part works perfectly thank you. My only question is how to did you
get it so on the EditItem page it would retrieve the outage id that was
passed a long and do the sql query from that to get an edit page with
the correct information??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top