Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3992380
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:45:29+00:00 2026-05-20T06:45:29+00:00

I have a feature which provisions a custom Default.aspx file to my publishing site

  • 0

I have a feature which provisions a custom Default.aspx file to my publishing site.

In the elements.xml, I have various AllUsersWebPart nodes which populate the zones with web parts. I need to supply a hardcoded ID (guid) to each of these web parts at this point — does anyone know how to do this?

I know that the format of a webpart ID is g_00000000_0000_0000_0000_000000000000, but if I add an ID property (see below) and then activate my feature, the guids of the webparts are all different.

<AllUsersWebPart WebPartZoneID="TopZone" WebPartOrder="1">
<![CDATA[
    <webParts>
        <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
            <metaData>
                <type name="..." />
                <importErrorMessage>...</importErrorMessage>
            </metaData>
            <data>
                <properties>
                    <property name="ID" type="string">g_FB777184_F9AB_4747_AA71_1BF0C96E535A</property>
                </properties>
            </data>
        </webPart>
    </webParts>
]]>
</AllUsersWebPart>

FYI: I need to hardcode an ID for each of my web parts because I have a seperate feature receiver which uses the ID to locate each web part on the page (I have 6x identical parts on the page with the same title) and then it assigns an audience to each part (so that only 1 is visible at any given time to a user).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T06:45:29+00:00Added an answer on May 20, 2026 at 6:45 am

    Good and bad news…

    The approach I was using is in fact valid, however it will only work if your web parts are not placed in a web part zone. If placed in a zone, the web part infrastructure automatically sets the WebPart.ID value (confirmed on MSDN).

    In order to hard-code the web part IDs, you need to place your web parts directly in the page layout (so that you can place them in directly within the page’s markup).

    Personally, I have opted to leave the web parts in the zones and instead use unique titles which I can use later in my feature reciever to identify the parts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a publishing feature which creates some site columns, a content type
I have a Custom List Definition (schema.xml) i have set up Site Columns (through
I have a custom feature which adds a few controls into the AdditionalPageHead DelegateControl.
I have a custom site definition which includes a form library. I have a
I have a custom feature which is an Edit Control Block (ECB) action in
I have a feature which allows the user to create projects and view it
I have a feature of my application which depends on alternate-click. Windows users don't
I have an ASP.Net application which as desired feature, users would like to be
I have an ASP.Net website which has a remember me feature for Login page.
I have the following form for photo_album which uses the nested forms feature of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.