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 8934261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:44:36+00:00 2026-06-15T09:44:36+00:00

I have a partial view in which I am trying to get the values

  • 0

I have a partial view in which I am trying to get the values from the parent view.
This is what I am trying:

 @Html.Partial("Shared", "Home", new ViewDataDictionary { { "9595959", "8sd8sds8das8d" } }) 

And this is the partial view:

      <!-- Google Code for apply Conversion Page --> <script type="text/javascript">
   /* <![CDATA[ */
   var google_conversion_id = "viewdata-number1";
   var google_conversion_language = "en";
   var google_conversion_format = "2";
   var google_conversion_color = "ffffff";
   var google_conversion_label = "viewdata-number2"; var google_conversion_value = 0;
   /* ]]> */
   </script>
   <script type="text/javascript"  
   src="https://www.googleadservices.com/pagead/conversion.js">
   </script>
   <noscript>
   <div style="display:inline;">
   <img height="1" width="1" style="border-style:none;" alt=""  
   src="https://www.googleadservices.com/pagead/conversion/viewdata-number1/?value=0&amp;label=viewdata-number2&amp;guid=ON&amp;script=0"/>
   </div>
   </noscript> 

Is it possible to get the value straight away? I don’t have any model or controller assigned to the partial view.
Thx in advance, Laziale

Updated Code:

@{
    var variable = ViewData["First"];
        <!-- Google Code for apply Conversion Page --> <script type="text/javascript">
   /* <![CDATA[ */
   var google_conversion_id = variable;
   var google_conversion_language = "en";
   var google_conversion_format = "2";
   var google_conversion_color = "ffffff";
   var google_conversion_label = "f6vICKTT6gMQzNOf3gM"; var google_conversion_value = 0;
   /* ]]> */
   </script>
   <script type="text/javascript"  
   src="https://www.googleadservices.com/pagead/conversion.js">
   </script>
   <noscript>
   <div style="display:inline;">
   <img height="1" width="1" style="border-style:none;" alt=""  
   src="https://www.googleadservices.com/pagead/conversion/1002957260/?value=0&amp;label=f6vICKTT6gMQzNOf3gM&amp;guid=ON&amp;script=0"/>
   </div>
   </noscript> 
}

You think that will work?

  • 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-06-15T09:44:36+00:00Added an answer on June 15, 2026 at 9:44 am

    Sorry i don’t understan your question quite well. You can get ViewData values in partial like this:

    var a = (int)ViewData["9595959"]; // variable a will get value "8sd8sds8das8d"
    

    You can also create new ViewDataDictionary extending current view ViewDataDictionary like this:

     @Html.Partial("Shared", "Home", new ViewDataDictionary(ViewData) { { "9595959", "8sd8sds8das8d" } }) 
    

    it will work like this:

     @{
         var variable = (int)ViewData["First"];
     }
        <!-- Google Code for apply Conversion Page --> <script type="text/javascript">
     /* <![CDATA[ */
     var google_conversion_id = @variable;
     var google_conversion_language = "en";
     var google_conversion_format = "2";
     var google_conversion_color = "ffffff";
     var google_conversion_label = "f6vICKTT6gMQzNOf3gM"; var google_conversion_value = 0;
     /* ]]> */
     </script>
     <script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js">
     </script>
     <noscript>
     <div style="display:inline;">
     <img height="1" width="1" style="border-style:none;" alt=""  
     src="https://www.googleadservices.com/pagead/conversion/1002957260/?value=0&amp;label=f6vICKTT6gMQzNOf3gM&amp;guid=ON&amp;script=0"/>
     </div>
     </noscript> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a partial view that is shared between two controllers and I'm trying
I have a partial view which is displayed on the top right of every
I have a partial view which contain JavaScript and Ajax, but does not run
I have a view Details which consists of a partial view _Tabs and a
Hi guys i have controller which returns a partial view, the controller is called
I am teaching myself asp .net mvc3. I have a partial view which uses
I have a view and a loop within which a partial view is rendered.
I have problem when I am trying to pass values back from my page
I'm trying to render a partial view on my master page using Html.RenderAction() in
I feel stupid asking this but I cant seem to get a partial view

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.