MVC :: Stuck. Trying To Create A Cms With Nested Partials?
Aug 21, 2010
I am currently trying to display multiple items on a single page. I am not sure as to how to tackle this. What I have is a database table that has all the page data in. I have this run as a PagesController and this works fine. However what I would like to do is, if say the Products page is selected via the menu, I want to pull back not only the Products page html but also get all the products, and even be able to pull them through via category. I was trying to use a partial view, but I can't get it to work. The same would be for other pages, having partial views to display the other content, ie if Gallery is selected, the page html for Gallery shows and it then can push to a partial view that pulls all the gallery images from the gallery db table and so on.
Maybe I am tackling this the wrong way. I have the pages stored in the db to allow for a CMS system I have setup. Maybe I need to use models for all the other items(Products, Gallery, Videos and such) and use the partial for the page html?
fixed on my own. couldn't figure out how to pull stuff in from multiple tables into one view.
View 3 Replies
Similar Messages:
Mar 1, 2011
I'm trying to create a nested gridview, but I'm stuck at the editing/deleting part of the nested gridview. (Below is my code).The nested gridviews are filling out nice, I've set the DeleteParameter in the SQLDataSource, but I'm still getting this error when trying to delete a criteria: 'The Gridview 'gvCriteria' fired event RowDeleting which wasn't handled.'I've tried to create a method 'gvCriteria_RowDeleting', but that didn't seem to work out.Someone who can give me a piece of advice? Would it be possible to fill the gridview without using gvDomain_rowDataBound? Dries
[Code]....
[Code]....
And the C# behind:
[Code]....
View 10 Replies
Mar 5, 2011
is there some way to share a partial razor view between areas? For example a login partial, it is found if i use @Html.Partial("_LoginPartial") but the URLs Html.ActionLink generates are local to the calling area (even though the partial itself is not part of the area).
_LoginPartial.cshtml is in /Views/Shared/_LoginPartial.cshtml
Calling view is inside /Areas/Somearea/Views
Links generated are like: [URL]
But should always be: [URL]
Partial view source:
@if(Request.IsAuthenticated) {
<text>Welcome <b>@Context.User.Identity.Name</b>!
[ @Html.ActionLink(@Messages.Logout, "Logout", "Account") ]</text>
}
else {
@:[ @Html.ActionLink(@Messages.Login, "Login", "Account") ]
}
View 1 Replies
Mar 23, 2011
If I have a partial that is used in multiple views that submits to its own dedicated action, then how do I know which view it has come from so I can go back to that view?
View 2 Replies
Oct 29, 2010
I have View which loads more than one partials.
[Code]....
It's convinient to me to divide menus for pieces. But number of partials keep growing and it is getting harder to find concrete partial in Shared folder. Can I store partials in view folder which uses this partial? Html.RenderPartial() doesn't have such parameter as Controller Name so I think that it's impossible. But if there are any solutions to solve this inconvinience?
View 2 Replies
Feb 25, 2010
I started removing part of a view into a partial so that it could be reused on another view. However, I got stuck because there are some JavaScript functions on the original view that call some of the functions that belong to the partial. It seems wrong to call functions that are defined on the partial from the containing view (and vice-versa). What is the best practice for this situation?
View 3 Replies
Feb 22, 2010
What is the recommended "cleanest" way to manage a partial that appears on many views and also requires a viewmodel (assume it needs to get some data from a DB).
View 2 Replies
Mar 7, 2011
My team is creating several solutions to develop separate branches of the same site. We have some CSS, partials, and master view files that we would like to somehow share between solutions. I have tried linking files but that has to be done for each and every file (cannot link directories, it seems). Does anyone have a tried and true system for doing this sort of thing for larger sites (other than putting everything in one massive solution)?
View 1 Replies
Jan 10, 2010
I have a simple website and I use masterPage for designing my template.
everythings work fine, but when I add a Custom (google) Search Box in it my pages correpted.
infact asp does not support Nested Form and as you all know google use a simple form to get queries from the users.
so at first I redesign my site and put 2 Form in it. One server form for my pages content and one other form for google search box. untill here everything work fine .
so I force to add 2 new button beside of my search box and these buttons need a runat=server form, so now I need an approach that let me enable a third form (second runat=server form ) or find an approach to use simple form inside of runat=server form, actually
howcan I put 2 form inside each other or how could we enable a nested form ?
View 2 Replies
Sep 21, 2010
Anyone know how to create a threaded / nested comment system? I would like to learn how to do this for my blog that I am working on. I simply can't find anything useful out there.
View 3 Replies
May 25, 2010
I'm try to create a nested listview with the following display:
Category 1
--Board 1
--Board 2
Category 2
--Board 1
--Board 2
--Board 3
Here is my code so far:
[Code]....
The Data is from a SQL Data Source:
[Code]....
However I'm not sure what to set the inner listview's DataSourceID to as I need to display just the boards in that category.
View 3 Replies
Feb 18, 2011
I am using ASP .NET 2.0 C#.
I have a Repeater that I created in my code behind. I want to create a nested repeater inside of that parent repeater. How do I go about doing that?
View 4 Replies
Aug 24, 2010
I have this so far but kind of stuck on how to do it programtically if I'm using header and content templates I have a xmldatasource..In a nutshell at what point in my code do I need to create a new accordion? does it need to be in the item_databound handler?
[Code]....
[Code]....
View 3 Replies
Jan 15, 2010
I have a nested repeater which displays a food menu - e.g.
Sub Heading
- Food 1
- Food 2
- Button 1
Another Heading
- Food 1
- Food 2
- Button 2
etc. etc.
What I have is a series of buttons inside the itemtemplate of the parent repeater (button 1 and button 2) which, when clicked, i need to somehow add a new blank textbox to below food 2 in whichever section it is clicked
I am having trouble doing this. See my code snippet below:
[Code]....
When I run this though, I receive an error of "object reference not set to an instance of object..."
Do I need to actually find a control within the footertemplate itself?
View 3 Replies
May 26, 2010
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message:
--
<html>
<head>
<title>Configuration Error</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Configuration Error</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b> Description: </b>An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
<br><br>
<b> Parser Error Message: </b>
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
Line 24: ASP.NET to identify an incoming user.
Line 25: -->
<font color=red>Line 26: <authentication mode="Windows"/>
</font>Line 27: <!--
Line 28: The <customErrors> section enables configuration </pre></code>
</td>
</tr>
</table>
<br>
<b> Source File: </b> c:inetpubwwwrootenterpriseweb.config<b> Line: </b> 26
<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
</font>
</body>
</html>
<!--
[ConfigurationErrorsException]:
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
(c:inetpubwwwrootenterpriseweb.configline 26)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_CustomErrors()
at System.Web.Configuration.CustomErrorsSection.GetSettings(HttpContext context, Boolean canThrow)
at System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute)
at System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e)
-->
--.
Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message:
--
<html>
<head>
<title>Configuration Error</title>
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
pre {font-family:"Lucida Console";font-size: .9em}
.marker {font-weight: bold; color: black;text-decoration: none;}
.version {color: gray;}
.error {margin-bottom: 10px;}
.expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
</style>
</head>
<body bgcolor="white">
<span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
<h2> <i>Configuration Error</i> </h2></span>
<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
<b>
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
<br><br>
<b> Parser Error Message: </b>It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
Line 24: ASP.NET to identify an incoming user.
Line 25: -->
<font color=red>Line 26: <authentication mode="Windows"/>
</font>Line 27: <!--
Line 28: The <customErrors> section enables configuration </pre></code>
</td>
</tr>
</table>
<br>
<b> Source File: </b> c:inetpubwwwrootenterpriseweb.config<b> Line: </b> 26
<br><br>
<hr width=100% size=1 color=silver>
<b>Version Information:</b> Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
</font>
</body>
</html>
<!--
[ConfigurationErrorsException]: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
(c:inetpubwwwrootenterpriseweb.config
line 26)
at System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(Boolean ignoreLocal)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_CustomErrors()
at System.Web.Configuration.CustomErrorsSection.GetSettings(HttpContext context, Boolean canThrow)
at System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute)
at System.Web.HttpRuntime.FinishRequest(HttpWorkerRequest wr, HttpContext context, Exception e)
-->
--.
View 3 Replies
Apr 6, 2010
I have a WCF Web Service that my ASP.NET app uses. It has been working fine for quite some time. I just added in a Dev Express Grid (and the Dev Express DLLs) and a new page that uses them and now I am getting parsing errors on the WSDL. But the weird part is that it works fine on my machine but fails on the web server machine. (Both are connecting to the same web services WSDL.) Here is the error message I am getting:
Server Error in '/MyWebAppWebDev' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Reference.svcmap: Failed to generate code for the service reference 'MyWebAppService'.
Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'WebClientApp.MyWebAppService.ReferenceUpdatesDataContract, WebClientApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contract name 'ReferenceUpdatesDataContract' in namespace '[URL] cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types.
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:portType[@name='IMyWebAppReferenceDataServiceLib']
Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:portType[@name='IMyWebAppReferenceDataServiceLib']
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:binding[@name='MyWebAppServicesDefaultEndpoint']
Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='[URL]wsdl:binding[@name='MyWebAppServicesDefaultEndpoint']
XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:service[@name='MyWebAppReferenceDataServiceLib']/wsdl:port[@name='MyWebAppServicesDefaultEndpoint']
Source Error:
[No relevant source lines]
Source File: /MyWebAppWebDev/App_WebReferences/MyWebAppService/ Line: 1
I am completely stumped on this. I have checked my web.config endpoint address and it is spot on (and notably is not in the error message above).
Things I have tried:
Giving permissions to C:Windows emp to my Website user name
Giving permissions to C:Windows emp to my App pool user name
Checking to see that none of my data contracts are generic and have IsReference=true in them.
View 1 Replies
Jun 1, 2010
i have an application wherein i am accessing the Session object in the CommonCode.cs file that resides in the App_Code folder. But when the session object is accessed the application throws me an error Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \ section in the application configuration.Now i have already enabled the session state property in the web.config file, here is my code from the web.config file:
[code]...
View 1 Replies
Jun 21, 2013
I set up a DAL layer in a dll. This had a couple poorly named methods such as GetData(), which is the default name offered up in the tableAdapter wizard. I also added a few other methods for various reasons, all with better names. I then built the dll and referenced it in an ASP project. On one page, I added an ObjectDataSource, and set it to that tableAdapter (which isn't what I wanted to do, but that's a different story). Under the Select tab, I see the GetData and the other methods. Under the Update tab I see a variety of Update methods. Under the Insert and Delete tabs....I see the same methods as I saw under the Update tab. The Insert and Delete methods that exist for the tableAdapter were not available.
I figured that I did something wrong, and I didn't like that GetData name, so I went back to the dll and changed some things around (I think I added an Insert and Delete method, but by now I can't remember, except to say that I wasn't all that surprised not to see those two methods the first time). I also changed the GetData name to something else, then rebuilt the dll.
Since that time, I have yet to be able to change what shows up in the Object Data Source configuration. The Select adamantly insists on the GetData method, which no longer exists under that name, while the other three tabs all show a variety of Update methods, but neither Insert nor Delete. I noticed that just adding a reference didn't have any impact until the ASP project was built, which moved the dll to the bin folder where it needs to be for the Object Data Source configuration wizard to see it. Therefore, I deleted the dll from the bin folder, then rebuilt. I've also removed the reference, deleted the dll from the bin folder, rebuilt, added the reference, rebuilt again to get the dll back into the bin folder, and anything else I can think of. It still seems to be retaining the original schema from the tableadapter without ever updating to the new name for the GetData. Since that hasn't updated, the rest doesn't surprise me.
View 25 Replies
Jul 30, 2010
I have CheckedListbox and grid. Based on what are the items checked in listbox that much of items need to be shown in grid. My SQL procedure like ;
select * from Emp
where city in (@Names)
Everything is ok if I am checked any of the item and click OK. If I am nothing checked from the listbox I need to display all of the cities from DB. I need to do this work without modifying my procedure. So need to work out in front/end. If I pass nothing from the code the query seemed as select
* from Emp
where city in ('')
So no records getting...
View 7 Replies
Jul 1, 2010
I'm all set up with Visual Developer 2010 Express and successfully (yaaah) worked my way through the NerdDinner tutorial (thank you, thank you, thank you!). So, I think I have everything set up correctly so far. I used the "Install Everything" without the prebuilt apps and all went smoothly.
However, my goal is to set up CMS for a small company owned by a relative so they can update their website as necessary. I'd love to do this with MVC.
I have tried to install both N2 CMS and Umbraco, but can't get past the admin and user names and passwords for the database. Since I'm failing with both apps, I think it's something about setting up the database server that I need to understand.Win 7 Home Premium 64, home system, not on a network. what I need to enter for admin / admin passwords and user / user passworks for N2 CMS and Umbraco?
View 2 Replies
Jul 15, 2010
I've written a desktop application using VB.NET and SQLEXPRESS. Now I am trying to deploy it to WS 2k3. But getting positive results wiht SQLE is proving difficult. Here is the connection string I am using:
connectionString = "Data Source=.SQLEXPRESS;" + "AttachDbFilename=" + DBPath + ";" + "Integrated Security=True;" + "Connect Timeout=30;" + "User Instance=True"
The problem is the results I get from the setting of 'User Instance'. Like it is, it loads a unique stance of SQLE, which is fine. But the instance just keeps eating memory. I tried limiting memory with sp_configure, but nothing happened. It just keeps growing. If I exclude 'User Instance', it uses the SQLE service running on my machine. It ignores the memory limitation, but eventually settles and stops growing.
Those results came from working on my local machine.When I put it on 2k3, I get the same results with User Instance = True; runaway memory. With User Instance = False, I start getting the 'attempt to attach an auto-named database failed' message. So now I am stuck. I would like to go with the 'User Instance = true' option, but I don't know how to deal with the runaway memory. If all else fails, I could use the =False option, but I just can't get 2k3 to allow.
View 1 Replies
May 11, 2010
I've built a ASP.NET webservice and I'm trying to access it from a Blackberry. I've been testing it out with multiple devices and the simulator and it works fine, but there's just the one Blackberry 9000 (It's not the model, I've tried it out with another Blackberry 9000), and it's stuck waiting for a response from the server. Relevant section of the code that accesses this -
System.out.println("IN ntwk access thread, start point");
HttpConnection connection = (HttpConnection)Connector.open(serviceURL + WSNAME);
connection.setRequestMethod(HttpConnection.POST);
connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-length", Integer.toString(postData1.length));
OutputStream requestOutput = connection.openOutputStream();
requestOutput.write(postData1);
requestOutput.close();
final int responseCode = connection.getResponseCode();
if(responseCode!= HttpConnection.HTTP_OK) {
//Process the error condition
}
// Request succeeded process the data.
It seems to be getting stuck after connection.getResponseCode(). Is there some way I can verify what's going wrong with this particular device?
View 1 Replies
Jan 18, 2011
I am working on a web service program but is stuck. i dont know what to do after I use the foreach statement to retreive my data.
using System;
using System.Collections;
using System.Collections.Generic; [code]....
View 5 Replies
Sep 9, 2012
I want to print ID with Barcode
I am using this codeĀ
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head><body>
<form id="form1" runat="server">
[Code] ....
I want to give iD in textbox1 and submit after submitting it Text Box 2 should get ID and Barcode both so that from there I can get print ... how can i do this process..
public void CreateBarcode(string data) {
imgPath = string.Format("{0}{1}.png", path, data);
Bitmap barcode = new Bitmap(1, 1);
Font threeOfNine = new Font("IDAutomationHC39M", 60,
System.Drawing.FontStyle.Regular,
[Code] .....
View 1 Replies
Feb 18, 2010
I have a form that allows users to post text to a MySQL database using an OdbcConnection. Everything works great until a user entered unicode characters into the textbox and sends the data. Suddenly the page freezes and is not redirected to the next page as programmed. When I check the database later it comes up with all of the users data intact, including the unicode characters. I've duplicated this problem several times by entering unicode characters and then entering only ASCII. It happens every time unicode characters are used. Is the problem on the ASP.Net side or the MySQL side? Here is my code. The description string is from a textbox entered on the form.I thought about using a RegEx to get rid of any non-ascii characters before sending the data. Is that recommended? How do I do it?
[Code]....
View 1 Replies