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


Top 5 Contributors of the Month
david stephan
Post New Web Links

Rendering Partial view postback with data posted back and entire view context

Posted By:      Posted Date: August 29, 2010    Points: 0   Category :ASP.Net
 
This is the base Index.aspx view:<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <%@ Import Namespace="LMWebUI.Components" %> <%@ Import Namespace="LMWebUI.Models" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <% Session["HasScripts"] = "false"; %> <% if (Utility.FixNull(Session["LoggedIn"],"false") == "false" ) {%> <% ViewData["Login"] = new PartialRequest ( new { controller = "Account", action = "LogIn" } ); ((PartialRequest)ViewData["Login"]).Invoke(ViewContext); %> <%} else {%> <div>Logged In Content here</div> <%}%> <script type="text/javascript"> LMx.init(); </script> </asp:Content> This is a helper class> that I found elsewhere, doesn't solve the problem, but still works to display the viewpublic class PartialRequest { public RouteValueDictionary RouteValues { get; private set; } public PartialRequest(object routeValues


View Complete Post


More Related Resource Links

problem when passing data from view back to controller?

  

I have following situation - I am pasing user info object from Controller to View. It contains GUID UserID,  which i dont want to be seen on page.

So I  removed every   Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc... from generated View source.

And because of this when Html.BeginForm() returns that object back to Controller  all values is there but UserID is lost??


If I leave Html.LabelFor(model => model.UserID), Html.TextBoxFor(model => model.UserID) etc.. in View everything is fine.

But I dont want to show UserID?

Where is the problem here?



                <%= Html.LabelFor(model => model.C__User_Id) %>
            </div>
            <div>

How to save the Entire Grid view data into sharepoint List using Visual Webparts ?

  

Hai Friends,

        I am Ali, I want to retrive the Entire Grid View data in to Sharepoint List using visual webparts. Present i am using FOR EACH condition for grid view, but it doest support for saving information into list items.

        and also i want to save the information that who has selected radio button in Grid View(Ex: If user select 'Present' or 'Absent' or 'OnDuty' or 'Leave' in these any one) that should be save in sharepoint list.

Please anybody help me,

Thanks

Ali.


Rendering Area Partial view from External Dll

  

Hi,

I am quite new to MVC and am gradually overcoming all my 'but WebForms can do that' issues but I still have one.

I wish to have components which I can deploy into an Area in order to keep things nice and tidy. This area will have a bunch of re-usable partial views like this.

MyArea/Views/Shared/MyAreaControl.ascx

I can render this MyAreaControl partial view fine in other Views inside that area but it fails when I try to render it from a not inside the area (e.g. view in the root of the site).

I am essentially using this syntax

<% Html.RenderPartial("MyAreaControl", new { area = "MyArea" }); %>
which seems to only look for this partial view inside the root Views folder, not the area one despite me specifying the area.
Is this a restriction of the system, a bug - or am I just doing it wrong.

Conditional Partial View Rendering

  

This is probably a no-brainer, but my head is not working today.

Just to get it work, I got a controller action that make use of a switch statement to decide which partial view to render, based on one of the members of the model passed in.  (Written by someone else for what it matter...I'm just cleaning up)

The viewmodel is overcomplicated, but that's not my decision right now and just have to live with it.

All partial's get rendered passing the same viewmodel, just a different partial get called.

 switch (model.something.code)
      {
        case 1: 
          return PartialView("partial111", model);
		case 2:
			return PartialView("partial222", model);
			
		// ... and so it goes on...




partial view, 2 controllers

  

 Hi,

This is my first visit to the forums, I hope someone here can help me

 

I'm writing a small webapplication for creating repair tickets and adding comments, really basic

now I'm writing this in MVC2

So I have 2 controllers, 1 HomeController that does everything related to the tickets (listing tickets, creating new ones, editing) and 1 controller for the comments

the edit view for the homecontroller contains a partial view for /comment/create

so /home/edit/ticketnumber can edit the title and status of the ticket on the left side of the screen, the right side of the screen contains the partial view for adding comments

this is done like this:

Html.Renderaction("Create", "Comment");


but if I look at the generated html code when running the app, both save buttons go to /home/edit/ticketnumber

so the comment is never saved.

 

I hope this makes sense and that someone can help me solve this


Vista and Office: View Data Your Way With Our Managed Preview Handler Framework

  

Stephen Toub shows you how to write your own Preview handlers for Windows Vista and Outlook 2007.

Stephen Toub

MSDN Magazine January 2007


Disable filtering on a Dynamic Data list view.

  

I have an entity set of NotificationTemplates, and each one of these has a collection of zero-many SmsTemplate entities. When editing or viewing a NotificationTemplate, I have a link to View SMS Templates. That link takes me to a List view for the SmsTemplates entity set, filtered for the NotificationTemplate I was viewing.

How can I prevent the user changing this filter to show SmsTemplates for another NotificationTemplate? That is, I want the filter, but it must be read only. The drop-down just mustn't drop down, it must just display the name of the NotificationTemplate that these SmsTemplates belong to. To view SmsTemplates for another NotificationTemplate, the user must click View SMS Templates from that other template.


This was originally asked by myself on SatckOverflow at: http://stackoverflow.com/questions/3514373/disable-filtering-on-a-dynamic-data-list-view



show data in grid view error Arithmetic operation resulted in an overflow.

  

sir

i have a table there is 17 columns in 17 column 3 are number and other are varchar . when i try to display all data of that column error occures.

one more intersting think is when i try to display 6 column then grid show there data an no more error occures. 

when i run my project this error occures in grid view

Arithmetic operation resulted in an overflow. 


Entity Data Model and database view returning the same columns as there are in a table

  

When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?


I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.


var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...


Thanks, Jenda


Personal view reverts back to default after updating properties of item

  

I am working with a company that has 1 site collection with several sub sites.  I have built 3 document libraries with workflow in 3 different sub sites and all behave as expected.  I have one site where ALL libraries do something perplexing;

If you are in a custom personal view and you go into the properties of a document and then exit (update or not, does not matter) it reverts back to the default view of that library. 

Has anyone seen this?  is there an option when creating an album that could cause this?

thanks in advance for any input on this odd issue.


How can I get it back to a standard view?

  
I already convert the standard view from Sharepoint to XSLT Data View. I also change the column width, how can I get it back to a standard view?

How to create scrolling table for columns in a SharePoint Designer Data View

  

I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

Add page numbers for paging in data view web part

  

Hello all,

Has anyone found a solution that will allow me to have page numbers for paging in a data view web part. For instance, if I have 40 items/rows and I set the paging to display 10 items, I'd like the paging to show 1 2 3 4 rather than showing 1-10 and having to click next over and over to get to a specific item.

I found this article, but it is for 2003 and doesn't seem to apply to 2007 or if it does I am not able to really figure out how.

http://blogs.msdn.com/b/cjwalker/archive/2005/05/28/422826.aspx

Please help!

Thanks in advance.

S


Disappearing partial view

  

I have a view that uses a partital view.  The partial view is invisible when the page loads.  The user then clicks a button and I use Html.RenderPartial to make the view appear.


There is a button in the partial view in which the use will click which should make the partial view disappear.  How do I make the partial view disappear?

Thanks for the help!



MVC view displays Preveously loaded data only

  

Hello,

1. May be it loading page either from History or Chache memory.

2. When anonymous user open about-us page or Home page then we display only 4 menus. And immediatly Normal user logs in and

open about-us page or Home page it again display only 4 menus instead displaying all menus available for registered user. I

have used the PartialView and render it in Master page(use the code Html.RenderPartial("Menus")) see the following code...

<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%: ""%>
<div id="menucontainer">
    <ul id="menu">       
            <%  If Request.IsAuthenticated = False Then%>
                <li><%= Html.ActionLink("Home", "Index", "Home")%></li>
                <li><%= Html.ActionLink("Register", "Register", "Account")%></li>
              

DataContractSerialization - View the serialized data

  
I am trying DataContractSerialization for the first time and I would like to see the results of my serialization. Some fields seem to be missing, and it is difficult trying to debug it without being able to see what is being serialized. I have tried both the CreateBinaryWriter and tried the CreateTextWriter with the hope I could view what it serialized: Dim str As New MemoryStream() Dim dcs As New DataContractSerializer(GetType(CustomerAccount)) 'Using w As XmlDictionaryWriter = XmlDictionaryWriter.CreateBinaryWriter(str) ' dcs.WriteObject(w, Me) 'End Using Using w As XmlDictionaryWriter = XmlDictionaryWriter.CreateTextWriter(str) dcs.WriteObject(w, Me) Debug.WriteLine(w.ToString()) End Using In either case, I cannot find a way to view the results with actually deserializing back to an object. (I have used the XMLSerializer in the past and it was always easy to see the result of the serialization without actually deserializing.) Any tips would be appreciated.    www.insteptech.com ; msmvps.com/blogs/deborahk We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!

Data Mining - Business User's view

  
Using BIDS, when I create a Mining model solution I can see lot's of useful utilities like Mining Model viewer, Mining Model Prediction etc that comes with lot's of graphs' etc. What would be the best approach to display these graph's to business users. Can I do this efficiently using SSRS or Do I need to use PowerPivot etc..
Categories: 
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