How do I Enable Crud and other properties in ListViewWebPart programmatically

In SharePoint (SharePoint Designer) 2010, to use a custom list in different sites, we used the resource to export the to site gallery. So the list became a list web part where I could use all the available resource list created on the
same site (examples: list settings, crud, views ...)
We need to provide the same functionality in 2013 programmatically for the user. We try ListViewWebPart class to use, but the resources of crud on the list were not available.
I Would like to how do I enable crud and other properties in ListViewWebPart or if there is another class that does it.
Thanks in advance

Try below:
http://www.dotnetcodesg.com/Article/UploadFile/2/216/CRUD%20%28Create%20Read%20Update%20Delete%29%20Operations%20on%20a%20SharePoint%20List%20programmatically.aspx
usingSystem;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.SharePoint;
namespace SharePoint__CRUD_Operations_on_a_List
{   publicpartialclass Form1
: Form   {
     public
Form1()     {
          InitializeComponent();
    private voidForm1_Load(object
sender, EventArgs e)
         BindAllRecords();
    private void BindAllRecords()
          using
(SPSite site = newSPSite("http://localhost:7000"))
                using
(SPWeb web = site.OpenWeb())                 {
SPList list = web.Lists["MyContacts"];
SPListItemCollection items
= list.Items; cmbItemId.DataSource = items.GetDataTable();
cmbItemId.DisplayMember =
"Id";
cmbItemId.ValueMember =
"Id";
private void btnAllItems_Click(object
sender, EventArgs e)         {
GetAllItems(0);
private void btn_Search_Click(object
sender, EventArgs e)
using (SPSite
site = newSPSite("http://localhost:7000"))
using (SPWeb
web = site.OpenWeb())                 
SPList list
= web.Lists["MyContacts"]; SPListItemCollection items
= list.Items; foreach(SPListItemlistItemin
items)                 {
if (listItem["ID"].ToString()
== cmbItemId.SelectedValue.ToString())                         {
textBoxTitle.Text = (string)listItem["Title"].ToString();
textBoxName.Text = listItem["Name"].ToString();
textBoxAddress.Text = listItem["Address"].ToString();
textBoxContactNo.Text = listItem["ContactNo"].ToString();
textBoxCountry.Text = listItem["Country"].ToString();
lblErrorMsg.Text =
"Search Result";
lblErrorMsg.Visible =
true;
DataView dv = items.GetDataTable().DefaultView;
dv.RowFilter="ID="
+ cmbItemId.SelectedValue; dataGridViewAllItems.DataSource = dv;
private void btn_AddItem_Click(object
sender, EventArgs e)
using (SPSite
site = newSPSite("http://localhost:7000"))
using (SPWeb
web = site.OpenWeb())                 {
web.AllowUnsafeUpdates =
true;
SPList list
= web.Lists["MyContacts"]; SPListItem Item
= list.Items.Add(); Item["Title"]
= textBoxTitle.Text; Item["Name"]
= textBoxName.Text; Item["Address"]
= textBoxAddress.Text; Item["ContactNo"]
= textBoxContactNo.Text; Item["Country"]
= textBoxCountry.Text; textBoxTitle.Text =
textBoxName.Text =
textBoxAddress.Text =
textBoxContactNo.Text =
textBoxCountry.Text =
 Item.Update();
web.AllowUnsafeUpdates =
false;
lblErrorMsg.Text =
"Item Added Successfully...";
lblErrorMsg.Visible =
false;
GetAllItems(0);
private void GetAllItems(
intItemID)
using(SPSite
site = newSPSite("http://localhost:7000"))
using (SPWeb
web = site.OpenWeb())                 {
SPList list
= web.Lists["MyContacts"]; SPListItemCollection items
= list.Items; if (ItemID == 0)
dataGridViewAllItems.DataSource = items.GetDataTable();
else
DataView dv = items.GetDataTable().DefaultView;
dv.RowFilter =
"ID=" + cmbItemId.SelectedValue;
dataGridViewAllItems.DataSource = dv;
    private void btn_UpdateItem_Click(object
sender, EventArgs e)     {
            using (SPSite
site = newSPSite("http://localhost:7000"))
                   using
(SPWeb web = site.OpenWeb())                    {
web.AllowUnsafeUpdates = true;
SPList list
= web.Lists["MyContacts"];                          SPListItem
Item = list.GetItemById(Convert.ToInt32(cmbItemId.SelectedValue));
Item["Title"]
= textBoxTitle.Text; Item["Name"]
= textBoxName.Text; Item["Address"]
= textBoxAddress.Text; Item["ContactNo"]
= textBoxContactNo.Text; Item["Country"]
= textBoxCountry.Text; textBoxTitle.Text =
textBoxName.Text =
textBoxAddress.Text =
textBoxContactNo.Text =
textBoxCountry.Text =
Item.Update();
web.AllowUnsafeUpdates =
false;
lblErrorMsg.Text =
"Item Updated Successfully...";
lblErrorMsg.Visible =
true;
GetAllItems(Convert.ToInt32(cmbItemId.SelectedValue));
       private void btnDeleteItem_Click(object
sender, EventArgs e)        {
            using
(SPSite site = newSPSite("http://localhost:7000"))
                  using
(SPWeb web = site.OpenWeb())                   {
web.AllowUnsafeUpdates =
true;
                        SPList
list = web.Lists["MyContacts"];                         SPListItem
Item = list.GetItemById(Convert.ToInt32(cmbItemId.SelectedValue));
                        Item.Delete();
web.AllowUnsafeUpdates = false;
lblErrorMsg.Text =
"Item Deleted Successfully...";
lblErrorMsg.Visible =
true;
BindAllRecords();
GetAllItems(0);
http://blogs.msdn.com/b/vssharepointtoolsblog/archive/2010/05/05/walkthrough-of-enabling-crud-for-sharepoint-2010-external-lists-using-visual-studio-2010.aspx
If this helped you resolve your issue, please mark it Answered

Similar Messages

  • How to read sort sequence and other properties of a specification in Cg02 .

    hello ,
    i need to update the specification properties in CG02 basing on sort sequence  for hazards and mariane pollutant of a specification.
    do we have any standard Bapi or Fm to read the properties of Specification .
    thanks for your help
    Ananta

    well -
    specifications are rather complicated - there are many tables linked by internal keys. As most of them (and all in the folowing overview) begin with 'EST' I only use the subseqent letters - so table ESTRH is written as RH below.
    Here an -  uncomplete - overview
    Header: RH
    2nd level:
    - RR References
    - RI Identifiers
    - MJ Material Joins
    - VH Valuation Headers (containing field ESTCAT for valuation type)
    3rd level:
    - VA - Valuation (instance - containing sequence number (field ORD - non unique!)
    4th level - data of the valuation:
    - PR Data stored in class system (such as regulation, DG-Class)
    - DU Usage
    - VP Components
    - 0F Transport Classification (containing Hazard Inducers)
    In general you can determine the related table if you look at the technical info at CG02. The structure name will be like
    "RCGxxIOT" where xx stands for the last two letters of the table ESTxx. The structure of interfaces in FUGR C1F5 are defined with a similar pattern: ESPRH_APIxx_TAB_TYPE.
    To read the data, you may use FM C1F5_SPECIFICATIONS_READ  which has sufficient documentation. You may refer to the documentation of obsolete FM C1F2_SUBSTANCES_READ as well.
    A good alternative is  BAPI_BUS1077_GETDETAIL - as this is a BAPI Function it should work after an upgrade while FM of C1F5 migh make some adaption necessary.
    However - it will take some days to understand both - the data model of specifications and the related FMs. I personally would recommend a developer familar with this 1yr+ before asking for implementations that are not only reading data - but they are hard to find....
    have fun!
    hp

  • How to disable 'Enable JavaScript' and 'Display PDF in browser' in Adobe Reader 9.1 msi?

    I'd like to how to disable 'Enable JavaScript' and 'Display PDF in browser' in Adobe Reader 9.1 msi.
    Any help would be appreciated.

    NeoChang:
    You can modify the installation package using the Adobe Customization Wizard to toggle the "Display PDF in Browser" but I have not found a setting to disable JavaScript from the Wizard. I have created a script which makes the changes, but it has to be run for every user since that info is stored in the User hive of the Windows registry.
    Disable JavaScript:
    REG ADD "HKCU\SOFTWARE\Adobe\Acrobat Reader\9.0\JSPrefs" /v bEnableJS /d 0 /t REG_DWORD /f
    Disable Browser Integration:
    REG ADD "HKCU\Software\Adobe\Acrobat Reader\9.0\Originals" /v bBrowserIntegration /d 0 /t REG_DWORD /f
    Michael
    ~Simplicity of Character is a Natural Result of Profound Thought~

  • How do i enable Redaction and apply it so that when I save it NO ONE can undo it

    How do i enable Redaction and apply it so that when I save it NO ONE can undo it

    In Acrobat Reduction is a two-step process.
    1. Tools->Protection->Mark for Reduction. In this step you mark all content that you want to reduct out.
    2. Tools->Protection->Apply Reduction. Then save the reducted PDF (with a different name/location if you want to have the original available).
    The Reduction tool in Acrobat permanently removes the reducted content from the saved PDF, so that it is not there. Because of that anyone who opens saved reducted PDF cannot undo reduction because the reducted content is not even in the file.
    Make sure that you performed step 2. If you just performed step1 and saved the file, the to be reducted content is still there. This is useful wgen several people reduct the same PDF and want to see what has been already reducted.

  • How to close Internet Explorer and other programs running on Windows?

    In order for Flash Player to be installed or updated, any programs that use Flash Player must be closed.  This includes Internet Explorer or other browsers, instant messengers, Skype, etc.
    These programs may be running in the background, not as visible windows, but need to be closed anyway.
    To close such programs use the Windows Task Manager.  To start Task Manager, take any of the following actions:
    Press CTRL+ALT+DELETE, and then click Task Manager.
    Press CTRL+SHIFT+ESC.
    Right-click an empty area of the taskbar, and then click Task Manager.
    Once the Task Manager is running, select the Processes tab.  On older Windows version you may need to click on the Process Name or Image Name header to sort the process names.
    Now right-click on every process that the Flash Player installer needs to close (e.g. iexplore.exe), then select End Process.
    It would be desirable if the Flash Player installer could perform that action by itself; I have therefore created an enhancement request.  If you were affected by this problem, please head over to the Bugbase and vote for this request: https://bugbase.adobe.com/index.cfm?event=bug&id=3548136

    See How to close Internet Explorer and other programs running on Windows?

  • How can I delete videos and other things uploads to icloud ?

    How can I delete videos and other things uploads to icloud ?

    If these are purhased movies they are not stored in your iCloud account and cannot be deleted.  They are stored in the iTunes store.  What you are seeing are links to your previously purchased movies, allowing you to redownload them.
    If you don't want to see these in the Videos app, go to Settings>iTunes & App Store and turn Videos off under Show All.

  • HT1338 How does one uninstall Garageband and other things?

    How does one uninstall Garageband and other things on the Macbook air?

    Uninstalling Software: The Basics
    Most OS X applications are completely self-contained "packages" that can be uninstalled by simply dragging the application to the Trash.  Applications may create preference files that are stored in the /Home/Library/Preferences/ folder.  Although they do nothing once you delete the associated application, they do take up some disk space.  If you want you can look for them in the above location and delete them, too.
    Some applications may install an uninstaller program that can be used to remove the application.  In some cases the uninstaller may be part of the application's installer, and is invoked by clicking on a Customize button that will appear during the install process.
    Some applications may install components in the /Home/Library/Applications Support/ folder.  You can also check there to see if the application has created a folder.  You can also delete the folder that's in the Applications Support folder.  Again, they don't do anything but take up disk space once the application is trashed.
    Some applications may install a startupitem or a Log In item.  Startupitems are usually installed in the /Library/StartupItems/ folder and less often in the /Home/Library/StartupItems/ folder.  Log In Items are set in the Accounts preferences.  Open System Preferences, click on the Accounts icon, then click on the LogIn Items tab.  Locate the item in the list for the application you want to remove and click on the "-" button to delete it from the list.
    Some software use startup daemons or agents that are a new feature of the OS.  Look for them in /Library/LaunchAgents/ and /Library/LaunchDaemons/ or in /Home/Library/LaunchAgents/.
    If an application installs any other files the best way to track them down is to do a Finder search using the application name or the developer name as the search term.  Unfortunately Spotlight will not look in certain folders by default.  You can modify Spotlight's behavior or use a third-party search utility, EasyFind, instead.
    Some applications install a receipt in the /Library/Receipts/ folder.  Usually with the same name as the program or the developer.  The item generally has a ".pkg" extension.  Be sure you also delete this item as some programs use it to determine if it's already installed.
    There are many utilities that can uninstall applications.  Here is a selection:
        1. AppZapper
        2. AppDelete
        3. Automaton
        4. Hazel
        5. AppCleaner
        6. CleanApp
        7. iTrash
        8. Amnesia
        9. Uninstaller
      10. Spring Cleaning
    For more information visit The XLab FAQs and read the FAQ on removing software.

  • Iphoto won't down load because My mac is a lion 10.75 I need 10.10?how do I download iPhoto, and other apps that won't download?

    iPhoto app won't down load because My mac is a lion 10.7.5 I need 10.10 ? how do I download iPhoto, and other apps that won't download? They were uninstalled by mackeeper (with me as an unwitting accomplice Thanks
    I've reinstalled lion os 10.7.5 and got the app store app back.
    Even though iPhoto etc are purchased by me in app store, theres no way they'll download.

    then
    reinstall from the original source
    Could be
    1 - the restore disks that came with the computer - if it came with CDs and you do not know where they are then contact Apple to see if they can be replaced
    or
    2 - the iLife DVD that you purchased
    or
    3 - the app store - log in under the Apple id used to purchase the software or to set up the computer - look under purchases - you might have to unhide or accept the Application first
    LN

  • How to set buildID.xml and custom.properties in SDK

    Hello,
    I just completed a new build deployment of SAP ME5.2, because after I deployed the new version, I don't think I have set a
    correct version number.Can you someone give me a sample how to set the buildID.xml and custom.properties? I am a new on the SAP ME5.2
    The Base version is ME_Base_5.2.5.16.5_netweaver-71_Update.zip and
    MEClient_Base_5.2.5.16.5_netweaver-71_Update.zip. the HB customzation
    version is ME_xxxxxx_2.0.0.0.x_netweaver-71.
    Within the sap note 1484551, you mentioned we need change the
    SDKInstallDir/build/buildID.xml file, here is the context of the file:
    buildID.xml -
    <?xml version="1.0" encoding="UTF-8"?>
    <buildID xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <customer>XXXXXX</customer>
    <revision>1.0.0.0</revision>
    <build>1</build>
    </buildID>
    buildID.xml -
    1. how can we change the revision and build?
    There is another file BuildToolDir/build/script/custom.properties, here
    is the file context:
    custom.properties----
    This file contains build properties used to configure the build
    system.
    The name of the software vendor implementing the customizations.
    vendor.name=xxxxxxxxx
    Vendor build identifier. This value is used to uniquely identify
    customizations built by a particular vendor for a particular customer
    and base
    application version.
    This is also used in path locations and in naming certain build
    artifacts, like the custom EJB module and the utility classes archive.
    vendor.id=xxxxxxxxx
    The installation of the J2EE engine installed in the development
    environment.
    ex. C:/usr/sap/CE1\J00
    j2ee.instance.dir=J2EEInstanceDir
    The web context path used to access the main web application. This
    is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    web.context.path=
    The web context path used to access the production XML interface web
    application. This is used by the build to set the
    context-root value in application.xml after an update has been
    imported.
    xml.context.path=
    The web context path to access resources from the web extension
    application, like images and work instruction HTML files.
    web-ext.context.path=web-ext
    The target database vendor. Valid values are 'oracle' or 'sqlserver'.db.vendor=ORACLE
    The JDBC driver configured for the application server.
    db.drivername=VMJDBC
    JDBC connection propertes for the WIP (Work In Process) database.
    This is the primary application database.
    db.wip.driverclassname=
    db.wip.driver.url=
    db.wip.host=
    db.wip.port=
    db.wip.sid=
    db.wip.user=
    db.wip.password=
    JDBC connection propertes for the ODS (Open Data Store) database.
    This is the offline reporting and archiving database.
    db.ods.driverclassname=
    db.ods.driver.url=
    db.ods.host=
    db.ods.port=
    db.ods.sid=
    db.ods.user=
    db.ods.password=
    Flag indicating whether to add DPMO NC codes to NC idat files when a
    new update is imported. This value is initially
    set by the installer according the the user selection.
    dpmo.nc.codes=
    The default locale used by the production system. The default locale
    is the locale used to display locale
    specific text and messages when the requested locale is not
    available. This property does not need to
    be set if the default locale is english.
    default.locale=en
    Used when running the build from Eclipse to locate the java compiler
    used by the WebLogic EJB compiler.
    jdk.home=C:/Program Files/Java/jdk1.5.0_20
    Compiler debug mode. If set to 'true', debug symbols will be
    compiled into the byte code.
    compile.debug=true
    Keystore alias
    security.alias=xxxxx
    Keystore password
    security.storepass=ChangeIt
    Key password
    security.keypass=ChangeIt
    Keystore type (jks=default,jceks,pkcs12)
    security.storetype=jks
    Optional source control build identifier that is to be displayed with
    standard version information.
    scs.build.ID=
    Optional extended version information to be displayed with standard
    version information.
    ext.info=
    custom.properties----
    2. How can we change this here?
    Regards,
    Leon Lu
    Edited by: Leon Lu on Aug 4, 2011 11:14 AM
    Edited by: Leon Lu on Aug 4, 2011 11:21 AM

    Hi,
    I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
    You can do this in compound layout.
    Regards,
    Stefan

  • How do I enable flash and java on firefox23 as I have the latest versions installed yet the plugin page shows "disabled" with no option to enable

    I have updated to Firefox 23 and it disabled my Java and Flash plugins. I then updated these to Flash 11.8.800.94 and Java to Version 7 Update 25. Now these are showing up on the plug in page but are showing "disabled" with no option to enable. How do I enable them to view content on the web.

    Thanks Philipp but i have already done that and the content started working...
    However, when i closed and restarted the browser it returned back to the same settings...
    I dont think that should happen, but anyway thank you for the solution. At least I can use it by resetting the values if need be
    Appreciate your help

  • How do I enable MallocDebug and Shark

    Ok,
    This is probably one of those "are you really that dense?" questions. But I have to ask. I have been using instruments with my iPhone app and they work fine. I would like to use MallocDebug and Shark but both those options are disabled in my project. How do I enable those options.
    Please help !

    Hi,
    I am also facing the same problem.
    I am able to use MallocDebug with cocoa console application but when I open iPhone application,
    both options (MallocDebug and Shark) are shown disabled.
    Can we use MallocDebug tool with IPhone applications?
    Please let me know if you kow the answer
    yathi

  • How to put echo command and other command in same line in Terminal

    Hello everyone. I use GeekTool (v3.0.1) and was wondering if I could put an "echo" command and another command in a shell script such that the output would be 1 line only instead of 2 lines for the 2 commands. How do I do that?

    This is why I think iTunes, in its present form, is completely unsuited for cataloging eBooks. However you can do what you want to do with the existing tags. Since a picture is worth a thousand words, here's a screen cap for you to illustrate how:
    And the various other sorting options:
    Give all that a try and see how it works for you.

  • I am fairly new to using Mac computers, I would like to know how to uninstall drivers, software and other things I might install on my computer. With a PC it's really easy, you just go to the control panel.

    I am fairly new to using Mac computers, I would like to know how to uninstall drivers, software and anything else I may install on my computer. With PC it's very easy, you go the control panel, locate what you want to uninstall and with a few clicks it's done. Can someone please help me? Thank you.

    See these:
    Switching from Windows to Mac OS X,
    Mac Basics—Tutorials on using a Mac,
    Mac OS X keyboard shortcuts,
    Apple How-To Guides for Mac OS X,
    Anatomy of a Mac,
    MacTips,
    Switching to Mac Superguide, and
    Switching to the Mac: The Missing Manual, Mavericks Edition.
    Additionally, *Texas Mac Man* recommends:
    Quick Assist,
    Welcome to the Switch To A Mac Guides,
    Take Control E-books, and
    A guide for switching to a Mac.

  • How to set default Header and Footer properties for PDF

    Hi,
    Currently we are manually setting the 'PDF and Print Control' properties for each and every dashboard. We understand that print pdf properties are controlled by pdfstyle.fst file under $SAROOTDIR\web\app\res\s_oracle10\b_mozilla_4 but don't have the exact property names to include in header and footer section.
    By default, we want to include company logo, the saved name of the report/dashboard tab and created time in the header. And page# in the footer.
    Where can we set these and what properties names should be used in order for these to be set for every new request/dashboard that is created.
    Thanks and Regards

    Hi,
    I created one request with logo in the header an page in the footer etc. and called StyleSheet. After you can import this formats by each request.
    You can do this in compound layout.
    Regards,
    Stefan

  • Iweb 08 installed but now navigation bar and other properties aren't showin

    iweb 06 was working beautifully. Then loaded iweb 08 and published. Now the navigation bar doesn't show in most browsers and other letter shadowing and picture shadowing aren't showing up as well. I've checked to be sure the navigation isn't turn off. I've published all and I've published singularly. Still no luck.
    Help please. Folks can't get to my site and navigate and see how nice it is...
    J.

    More details from another example:
    To illustrate what I see at the PC at work I made some sreenshots from my site:
    http://www.hasselo.eu/photography/Links_files/HasseloEuHome.jpg
    http://www.hasselo.eu/photography/Links_files/HasseloEuGalleries.jpg
    Since I made the screenshots, the site was updated with new content, but the problems are still the same.
    As you can see:
    -Navigation bar missing
    -Reflections missing
    I have no problems with other websites, therefore I assume that this is iWeb related and Apple should produce a fix for this.

Maybe you are looking for

  • Portege M700-7008x - How can I recover the system, if F8 ist not possible?

    The Notbook has an invisible partition, from which the system can repair or restore. Theoretically, should I start with f8 in the meantime. It does not work. The main problem is a mini change. I have to start over LAN to Disable. After the restart st

  • Font in shared library

    Hello everyone Been reading all your posts and tried everything, but nothing seems to work. The problem is: index.swf as a class named AssetsLoader.as. This class loads sharedlib.swf which as a font in it. I need to register the font at index.swf, bu

  • Reset BIOS Password

    I forget my BIOS password, and disable key is 94161153, please help me to find the unkown password

  • Messaging Application does not recognise contact n...

    Hi people, My phone is an E70 with 2.0618.07.10 (31-08-06) firmware. I updated it to this firmware via NSU. It had .07 firmware before.The Messaging app. had an annoying problem, which seems to be not fixed with the new firmware. I set the Contacts a

  • Need badi implementation

    hi to all experts,                        i need to implement sap predefined badi plz send me with screen shots how to implement predefined sap badis