kamagra how much to take

Updating A View Name With An Event Receiver

There was a question in the newsgroups regarding updating / altering a view name of a list through code when in an event handler. The solution is actually pretty simple, you can use the following code within the event handler in order to adjust the name of the view by passing in some simple parameters. The parameters that it takes are pretty straightforward, all it takes at the ID of the list that is going to be changed, the ID of the view that is going to be changed, along with the new name of the view that you want to apply. You have to get a reference of the list that you are wanting to adjust by passing in the ID of the list, and then get a reference to the view by passing view ID. Once you have that, you can adjust the Title property of the SPView object, then just update the view.

  1. public void UpdateViewName(Guid listID, Guid viewID, string newViewName)
  2. {
  3. SPList oList = web.Lists[listID];
  4. SPView oView = oList.Views[viewID];
  5. oView.Title = newViewName;
  6. oView.Update();
  7. }

Hope this helps someone.

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>