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.

link|improve this question

60% accept rate
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 at 9:22
feedback

1 Answer

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);
       }
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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