Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using SP2010 and am working with a list.

I'm working with a "Register.aspx" form (In Sharepoint designer) in which I've created a button which is set to re-direct after a save

<input type="button" value="Done" onclick="javascript:{ddwrt:GenFireServerEvent('__commit;__redirect={DispForm.aspx}')}"></input>

which when means when I click the "Done" button the item is saved and the edit form (called, stupidly 'DispForm') is opened.

How can I identify the ID of the newly saved item and pass that to the DispForm? At present it just opens the first item I had created.

share|improve this question
    
The current solution I've used is to hop to a separate page which runs a CAML query to find the new list items ID and open it from there. –  Dave Alger May 8 '12 at 9:22
add comment

1 Answer 1

I would suggest you build a server side control. This approach allows you to get access to SPContext.Current.Item . You can then easily do something like this:

private void onButtonClick(object sender, EventArgs e)
       {
           //Do Processing
           string currentitemID = SPContext.Current.Item.ID.ToString();
           this.Response.Redirect("URL?ID=" + currentitemID);
       }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.