C# - WebUserControls Get Type Infomation About Other WebUserControls Within The Project?
Feb 8, 2011
I'm basically trying to get webcontrols to talk to one another.I have one WUC that wants to get information from another.In ControlB's GetDataFromControlA method
public List<ControlBData> GetDataFromControlA()
{
ControlA c = Page.FindControl( IdOfControlA) as ControlA;
if( c != null)
{
return c.Data;
}
...
}
At code time ControlB knows nothing of ControlA...so ControlB cant access its members, and the above wont compile.
I'm thinking I have to use methods in the page to get the controls talking to one another...
I have a e-commerce cart with many itens. Each item has a product, quantity and some other fields. Each item was developed as a WebUserControl.My e-cart will have many of this WebUserControls that are loaded dinamically as users add them, edit and remove itens of the cart.If I add this WebUserControls in a Panel, I'll have to load it every time I postBack the page. If I put it in a Repeater, the WebUserControls will keep on the screen but all the controls inside of it will be cleared.So here comes my question:How to do it without having to reload my WebUserControls everytime I PostBack the page??? It takes too long for the user
I am very exited to find out how to do this.I have created 10 custom webusercontrols which is meant to be used on several custom sites on my website etc. and I want to find out how I can make a directory which will work the same as the asp.net.At the moment I have to register the webusercontrol at the top of the page like this:
How do I create a directory that contains all of my webusercontrols, so I only have to register the assembly and can use the prefix and then the intellisense will appear?
I currently work on a timesheet portal. One of the features is that as employees are submitting requests an email is sent out to the supervisor that lets the supervisor see that they have a request to approve. In this email is a link to the request that the supervisor can click on to take them to the link.Currently it looks like this.
the way it was written is that with the information that is given a user could manipulate the system to allow them to approve one of their own requests as their supervisor. While this has yet to happen, I want to prevent this from happening. Is there a way to create the link without giving away all the information? When you login currently the system keeps all the info in a session. But when you try and follow the link the system would take you to the request page as an employee, when it should be supervisor. This confuses the user and they logout and back in going through the menus to get to the requests and in the right state.At this point I would rather just have them goto the main menu, but that does not seem to be an option that everyone can be happy with. What other options could we try?
I have a website that has a login (Like most websites xD) This then obviosly fetches information from a database and loads it on the page. (EG. Welcome "Display Name")
I have designed and coded a application for my site you can use the features from my web on your desktop, I have added a login (required to use the application) and a register. Both login and register work (Fetching information from the database and writing to the database).
Now I have those out of the way I'm now onto the main part of my program which is to display infomation onto the application about the user account. This could include editing the user account, uploading content to the website or viewing content from the website.. (Sorry but I'd like to explain how I have certain things to get the point across clearly )
Anyway how would I create a sort of session? Like PHP, once you login you can grab information from the database based on the information submitted from the login which was fetched from the database.. When the user presses login on my application it brings them to the main part of the application but I'm now unsure how to load variables and/or session data.
(Side note, I have also sha encryption on my website in the register/login, at the moment VB reads the information from the textbox as normal text is there anyway I can get it to read the sha encryption? and also insert data into the database with this encryption?) - This question is optional.
If culture is en-GB then string dateFormat="dd/mmyyyy"; string timeFormat="24.00 hrs";
and so on for other countries..Now how do I get these date and time format values ? What are the standards? Like which all countries use similar date/time formats and which ones don't ?ok I tried this :- DateTime myDate = new DateTime(); string us = myDate.ToString(new CultureInfo("en-US"));
string us gets value =1/1/0001 12:00:00 AM
Now how do I extract "dd/mm/yyyy" and "24.00 hrs" out of this...in my Dateformat column in my Table... I want to store STRINGS such as dd/mm/yyyy or mm/dd/yyyy NOT dates..In my TimeFormat column in the table, the values to be stores are STRINGS too, like I need to store either "24:00hrs" or "12:00hrs"
How do I do this now ?**using ShorTimePattern returns these values as h:mm tt and HH:mm
If I want to store the values in my DB exactly as "24:00hrs" and "12:00hrs", how do I use these values..h:mm tt and HH:mm,which one is for 24 hr format and which for 12 hr format ?**I want the information about Decimal Separator and Thousand Separator too based on the CultureInfo...whats the property for that ?
Why I am getting this error 'MVCApplication1.Purchase.ProductInfo' is not defined?
Purchase.ascx
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of MVCApplication1.Purchase.ProductInfo)" %> <%@ Import Namespace="MVCApplication1.Purchase.ProductInfo" %> <%For Each item in Model.Product%>
I am trying to open telerik Q1 MVC examples in Visual studio 2010 and I am getting an error
C:Program FilesTelerikExtensions for ASP.NET MVC Q1 2011SourceTelerik.Web.Mvc.ExamplesTelerik.Web.Mvc.Examples.csproj : error : The project file 'C:Program FilesTelerikExtensions for ASP.NET MVC Q1 2011SourceTelerik.Web.Mvc.ExamplesTelerik.Web.Mvc.Examples.csproj' cannot be opened.
The project type is not supported by this installation.Do I need to change anything in my web.comfig file in order to make this run. Below I pasted my web.config file.
I have had a project called Articles and the project complies fine. I have it running as a seperate site on my machine and it works like a charm under IIS7. When I start the project from VS2010 in debug mode (by pressing F5) it lands on a page that says: "Parser Error Message: Could not load type 'Articles._Default'."
I i however change the path in the browser from [URL] Home it works fine again, indicating that my routing table is bust but it was working yesterday and I did not change any route, The error page also says: "Please do not delete this file. It is used to ensure that ASP.NET MVC is activated by IIS when a user makes a "/" request to the server." That idicates to me that it went to default.aspx...right?
I am running MS Vista with the 3.5 Framework. I just loaded VS2008 Express and VB 2008 Express. I was able to create a ClassLibrary project (vbproj) in VB2008. However, when I try and open that in VS2008, I get an error : vbproj cannot be opened because its project type is not supported. The thing is that I cannot create any projects in VS2008 excecpt for Blank Solutions, because there are no templates available to choose from when I attempt a FileNewProject in VS 2008.
I have an ASP.NET 3.5 solution which has 2 projects in it: class library (data access) and the web project. The project has now changed and requires me to change the design and only have one project and move the class library into the web project. I have successfully moved most of the class library into the App_Code folder I created but continue to get an error when I run the program. The error is in regards to the Linq to SQL classes or dbml file. I continue to get a error:
Compiler Error Message: BC30002: Type 'EntityRef' is not defined. Line 868: Private _CreateDate As Date Line 869: Line 870: Private _Code As EntityRef(Of Code) Line 871: Line 872: Private _Lab As EntityRef(Of Lab)
I have changed the dbml file to use the new connection string and modified any code behind by searching all the files in my project. But continue to receive this message. I've removed all the references to my old project and also removed any old .dll's which could have had references to it and continue to have the problem. Is there maybe a reference in my project I am missing or something else simple I have overlooked?
I should also mention when I move the .dbml file outside the App_Code folder (root of the website) and right click the project and select Convert to Web Application it works just fine.
I created my testing project by just adding a class library and referencing nunit dll. Works fine.However, I'm curious as to how get NUnit integrating with VS2010 just like MS Unit.Also any good reading on TDD with MVC 2 (like specific to the new functionality available in MVC 2)?
We are using nested master page the master page is seperate class library project and all the other projects refer to them. We wanted to have a basepage class which load title, meta tags and keywords dynamically. It was working fine till it was inside the main project. We wanted the basepage class to be more generic and to have it reside in a single place. So i tried created a seperate class library project but i getting error "Could not load type" ..
How to have the basepage class outside the project?
I have an ASP.NET 3.5 website application using C# and SQL 2005 running on a web server. Now the application has the ability to create new aspx pages with content and the relative aspx.cs and design.cs pages needed on the fly and store them in the base directory on the server. Think of it as a crued Visual Studio website on the server for admin to click a few options on a page then the new pages are created for them without the need of a web developer. This all works fine and the code is working 100% (for the moment).
My problem now is the following: When i now navigate to this newly created page i get the following error - Parse Error : Could not load type 'Namespace.PageName'
I've looked into the reasoning and microsoft say "These errors occur if the .aspx page contains a reference to a code-behind module and if the application has not been built." Which now makes sense the application does not realise that these new pages are part of its system even though i can navigate to them.How do i get the system to recognise these new pages and rebuild itself accordingly?Now i cannot rebuild the system localy then reupload to the server, this needs to be accomplished on the server by the system, because the site cannot afford to have down time everytime admin decide to add new pages.
I have a MasterPage project which is a class library project (it includes themes, style sheets, menus etc) and all applications use them.
I am using the BasePage concept for dynamically adding title,meta tags and descriptions. This BasePage Class inherits system.UI.Page and the aspx pages in the project inherits the BasePage class.
Now i need to move this BasePage class from my application to the Master Page Project so that all the projects/applications can reuse the same code.
I tried add the basepage.cs in the App_code folder and tried calling it in the page directive like below
<%@ Page Language="C#" MasterPageFile="~/Master/Layout/MasterPage.master" AutoEventWireup="true" CodeBehind="xxxx.aspx.cs" CodeFile="xxxx.aspx.cs" Inherits="xxxx" ValidateRequest="false" EnableEventValidation="false" ViewStateEncryptionMode="Never" CodeFileBaseClass="~/Master/App_Code/BasePage<Page>" Title="Title" Meta_Keywords="xxxx,yyyy,zzzz" Meta_Description="This is a test" %>
But i am getting error
Could not load type '~/Master/App_Code/BasePage<Page>'.
This was working fine till the BasePage class was inside the application. But once i moved it out of the project and added it to the master page project i getting this error.
When I turn on Code Coverage in my test settings, on a project that references the Unity DI container I get the following error:
Cannot initialize the ASP.NET project'{Project Name}'.
The event log specifies the following reason:
Could not load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name signature could not be verified.
I have list of class files, when i try to run the class files, it showing error as "a project with output type of class library cannot be started directly"
How to run the class file? How to create a dll file.
So bit the bullet and installed vs2010 finally. However, when loading an existing vs2008 project, I am getting this error: "The project type is not supported by this installation." the only thing special about this project is that it's a "web application projects" type. what I've tried so far are these steps, but none of these solve my problem:
(1) run "devenv /setup" (2) regsvr32.exe "%ProgramFiles%Microsoft Visual Studio 10.0Common7IDEProjectAggregator.dll"
I have downloaded a project from the internet called the SMS Source example. I wanted to open this project in VS2010, so a conversion wizard has popped up prompting for the conversion. But it has errors in converting.
On the Timelog page, I want to put 2 dropdown list: 1 Manufacturing Project, 1 Engineer Project. However, users can choose either Manufacturing project dropdown or Engineer project dropdown (not both).