.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Redirect to item page after inserting

Posted By:      Posted Date: October 19, 2010    Points: 0   Category :ASP.Net

After inserting a new item, I would like to redirect to the page of that inserted item, instead of the list page.

How can I accomplish this?

Thks in advance

View Complete Post

More Related Resource Links

Specify page to redirect to when adding a item


Hey guys/girls/aliens

When I add a new item to a list and I click on the OK button (NewForm.aspx), I want it to redirect to a other page
How can I do this?

Reason for this is because I modified the NewForm.aspx and added some javascript to it.
This causes the link to go to the Homepage instead of going back to the listview.




By the way, If i can solve this by adding the JS to the masterpage instead of the NewForm.aspx page.
Please tell me how :P

Redirect to a another page (from a new item form) with the new item's ID


Now, I have a custom form that redirects to another form. After submit the Ok button, it uses such link:


I want to redirect from NewForm.aspx to antoher's aspx form with the existing parameter IDO and new created ID (IDC), so the link would be:

http://site/lists/CustomerOrders/NewForm.aspx?IDO1=1&IDC={NEW ID}&Source=xyz/site.aspx?ID=1

I wanted to use http://spservices.codeplex.com/wikipage?title=$%28%29.SPServices.SPRedirectWithID&referringTitle=Documentation

but that function doesn't pass another paramteres, so the new link is:

http://site/lists/CustomerOrders/NewForm.aspx?IDC={NEW ID}

how can I pass the existing parameters (IDO and Source)?

LINQ to SQL - Validating if item is in Database, but if item is not items not inserting into databas



I am new to this, so bear with me.  I am writing an application in C# that uses LINQ to validate a datacontext off a textbox to see if the record exists already.  If the record does exist I inserted an if statement to advise the user that the record exists, if the record does not exist I would like to allow the record to be added to the database.  If I take out my else statement everything works fine as far as inserting goes, but I do not want to allow inserts in this scenario.  I have tried moving the if and else statement to different parts of the code but can't quite figure this one out.  Any help would be apprecaited, attached is the code.  This code is set to a button press.  As a matter of fact, if you see any other errors along the way please feel free to point them out. 



    protected void enterBTN_Click(object sender, EventArgs e)
        //make new data context

        SHCDataContext insNewAll = new SHCDataContext();
        //LINQ to check if customer exists in database
        var checkExisting = from c in insNewAll.Customers
                            where c.custLastName.Contains(custLastNameTB.Text.ToString())
                            select c.custLastName;
        //make list to store values

Redirect to a mobile page

Hi please can anyone help? I have a simple website with a home page called defaut.aspx, also I have a page with in this site called mobile.aspx. My question is, bearing in mind that I posses very little knowledge of VB, what code do I need to place in the default.aspx to detect what kind of device someone is using and redirect them to the mobile page (mobile.aspx)? This needs to be quite up-to-date preferably for blackberry and nokia devices?


Detecting PPC device on startup page to redirect?

I was wondering (since a search didn't find any posts) if there is a way for my startup page to detect what kind of device (PocketPC or web browser specifically) is loading the page and if it is a PocketPC, then redirect to the mobile pages? I will only be using PocketPC's exclusively as a mobile device.

Thanks for any suggestions!

After login redirect to a desired page

Hi,   Just a simple question. After I click login button, I want to page be redirected to display.aspx. How to set up it? Sorry for the silly question.

Adding a list item that populates a particular part of a page

I am trying to create a list view in sharepoint designer that when you enter a list value it populates the right part of the page. Background - I am creating a list for a marketing newsletter that when you fill out the list form it will populate the marketing newsletter on page. its to save recreating it every month. the list has drop downs for addition and department and the data is inserted on the page. thanksSharepoint Customiser

How to set the variation root redirect page to ALWAYS go to a preset label?

Hi. I have setup variations and I have 4 labels, SE EN FI DK. This is a public website and I want every visitor to first be directed to the predetermined label, for example SE. This no matter what setting they have in their browser... In Sweden, most people have English as the language in the browser since this gets you better content in most places, but in this case, it gets them the EN label instead of the SE label as default. How can I change this in the best way possible? Are there any easily adaptable solutions available? Like on codeplex? The MSDN way is not to my liking, manually customize every front end or compile my own DLL....Noo, there has to be a better way right? (How to: Customize the Variations Label Control Logic http://msdn.microsoft.com/en-us/library/ms551625.aspx) Appreciate any help you can give me on this. RegardsThomas BalkestÃ¥hl - Technical Specialist - SharePoint

Create buttons for "new item" which create a new page of a specific content type

We have a Pages library (wiki) which supports a few content types (and page layout associated). We want to enable users to click a button for example of "new custom enterprise wiki page" - so a new page of content type article will be open in edit mode. Can someone help how to develop? (it has to mimic the behavior that happens when user creates new page from the Ribbon or Site actions and has to choose the content type, it also has to keep the new page in edit mode and not just create it).  

Issue inserting to database on submit the page goes blank

Hi guys,I'm new to asp.net, can someone please help me with this. I'm trying to insert few values to a table, when i press the submit button the aspx page goes blank and i don't get any error message. I'm not able to find where the error is.The code:Protected Sub AddMInfo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddMInfo.Click Dim dbsource As SqlDataSource dbsource = New SqlDataSource         dbsource.ConnectionString = ConfigurationManager.ConnectionStrings("dbConnectionString1").ToString         dbsource.InsertCommandType = SqlDataSourceCommandType.Text         dbsource.InsertCommand = "INSERT INTO db_mdl_info(dlprodid,dlmdlid,dlbrnd,dlmdlnm,dlmdlnbr,dlcpst,dlprsr,dlmxm,dlmim,dlmslt,dlmxps,dlmtpe)" &                                 "Values('" & DropDownList2.Text & "','" & DropDownList3.Text & "','" & MakeTextBox.text & "','" & DropDownList2.SelectedItem.Text &                                 "','" & MNoTextBox.Text & "','&quo

Response.Redirect in C# for page to page parameter passing

Looking for examples of this, but can't find anything specific. I'm new to ASP.NET, and C# at the same time... so I'm struggling to get it right...  Thanks, Nick

Getting Selected Item in radiobuttonlist on content page using javascript

I am trying get the selected value from a radiobuttonlist on a content page using javascript. Here is my initial code, which does not recognize the control. The js is located in a separate file and there is a link on the content page pointing to the js file. Thanks, function GetRadioButtonValue() { var radio = document.getElementsByName('<%=rblPayType.ClientID%>'); for (var j = 0; j < radio.length; j++) { if (radio[4].checked) { alert(); return; } else { return; } } }    

Authentication required, redirect to login page

Hi,I want authentication required for all webpages in a site. If i copy the url of any of the web page in the current site and paste it in the url address i should redirect to login page. If you have any solution please suggest it.

Search results page showing random characters instead of item's description

I have an email-enabled document library that a few Japanese people email PDF files into (all external to the company). When I search for any PDF file sent from particular email addresses, the search results page displays random characters instead of the item's description. Here is an example: From Screen shots These characters don't appear for all email senders, just some of them. Our MOSS site is in English and we don't have any language packs installed. The PDF file contents are also in English. Can anyone point me towards a solution for this?

SPWeb.Properties is not persist over the redirect page.

Hi, I have to pass some object from my code to another redirected page. So I serialize the object and serialized string is save to SPWeb's property as a string and after that I use SPUtility.Redirect('Url'). But on redirected page above updated property is not find in the SPWeb.Property collection. string xml = MyClass.GetXMLFromObject(exInfo); SPContext.Current.Web.Site.RootWeb.AllowUnsafeUpdates = true; SPContext.Current.Web.Site.RootWeb.Update(); if (!SPContext.Current.Web.Site.RootWeb.Properties.ContainsKey("MyInfo")) { SPContext.Current.Web.Site.RootWeb.Properties.Add("MyInfo", xml); SPContext.Current.Web.Site.RootWeb.Update(); } else { SPContext.Current.Web.Site.RootWeb.Properties["MyInfo"] = xml; SPContext.Current.Web.Site.RootWeb.Update(); } SPContext.Current.Web.Site.RootWeb.AllowUnsafeUpdates = false; SPContext.Current.Web.Site.RootWeb.Update(); SPUtility.Redirect("RedirectToErrorPage/ApplicationPage1.aspx?ExInfo=" +xml, SPRedirectFlags.RelativeToLayoutsPage, HttpContext.Current); Redirected page code: if (SPContext.Current.Web.Site.RootWeb.Properties["MyInfo"] != null) { using (SPWeb web = SPContext.Current.Site.OpenWeb(SPContext.Current.Web.Site.RootWeb.Url)) { TextBox1.Text = Convert.ToString(SPContext.Current.Web.Site.Root

how to redirect user to login page if session is null

i have 2 page,1.login.aspx ---  2.welcome.aspxin my login.aspx im storing username into sesssion as below:Session["usernm"] = txtUsername.Text;in my welcome.aspx  pagein page_load event if (Session["usernm"]==null)        {            Response.Redirect("Login.aspx");        }----- here if i manulally paste the url ( http://localhost:4125/Loginado/welcome.aspx) it should go to  login.aspx for user credentialsbut its going directly to welcome.aspx  page.

MOSS Upload Attachment to List Item 404 page not found

Hi, when some users upload an attachment to a list they receive a 404 Page not found error when they attempt to save the record (not at upload). Other users do not experience this. I have amended permissions and this had no effect and cannot identify a pattern. Does anyone have any ideas?
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend