MVC :: Hierarchical Component Architecture Incompatible?
Nov 17, 2010
I'm building an ASP.Net MVC 2 application with a component architecture. There are two different types of components: Elementary Components, which have an associated controller action rendering a partial view, and Layout Components, which render all their child components (Elementary Components or again Layouts) in a certain layout.Here is my generic RenderComponent() action method, which takes a component ID and renders the appropriate view:
[Code]....
Is my hierarchical component architecture incompatible with ASP.Net MVC? How would you build such a system in ASP.Net MVC?
View 1 Replies
Similar Messages:
Feb 19, 2010
1. Can you explain me what is component based development ? What I am already doing is using layers (user interface, custom types, data access layer and busines logic layer). For example for filling a drop down list with countries what I do is getting data from DAL using custom types in my BLL and BLL return a list of countries to user interface. Now in my opinion it is a plug-able component that I can use anywhere. Should it be called a component ?
2. What is a component a method ? or class or a assambly ?
3. Can components be like that (methods and assemblies) or they are services to embed ?
4. Actually I never have used services, if component can be in both ways (services & classes and assemblies) than what approach is better, should component be made in form of assemblies or services ?
5. Without being so technical any general rules on making re-usable components ?
View 2 Replies
Aug 3, 2010
I am trying to stop the data flow when certain conditions happen in the script component. Like if a row in the data set has an invalid date, I dont want that dataset to be inserted in the tables or go through OLEDB Destination, rather I want the entire data flow for that dataset to stop and go back to the control flow page.
I have tried mulitple solutions but nothing worked. Conditional Split ends up inserting the correct rows, but I just dont want anyting to be inserted when one row is bad, where as I do want the entire dataset to be inserted if all rows are good.
How can I fail the component when certain conditions happen int eh script component.
View 1 Replies
May 18, 2010
I would like to know how can I list for every page (child page) selected the number and id of localize component in the current page. I need this to update resources files, a button will be on the master page and when they click on it, they will go to a page which show up every data in the resource file.
View 1 Replies
Feb 10, 2011
i got a problem.. how i can declare template textbox in a datagrid at code behind? i already make a stored procedure and put the update query inside it.. if i declare the textbox inside code behind(.aspx.vb).. there will be an error.. " there is already a component named "txtitem1"component must have a unique name.."
Dim con As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString1"))
Dim cmd As New SqlCommand
Dim sda As New SqlDataAdapter
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "ETendering3"
cmd.Parameters.Add("@item", SqlDbType.NVarChar).Value = txtitem1.Text
cmd.Parameters.Add("@price", SqlDbType.Decimal).Value = txtprice1.Text
cmd.Parameters.Add("@remark", SqlDbType.NVarChar).Value = txtremark1.Text
cmd.Parameters.Add("@consump", SqlDbType.Decimal).Value = txtconsump1.Text
cmd.Parameters.Add("@value", SqlDbType.Decimal).Value = txtvalue1.Text
cmd.Connection = con
Try
con.Open()
DataGrid12.DataSource = cmd.ExecuteReader()
DataGrid12.DataBind()
Finally
con.Close()
End Try
con.Dispose()
cmd.Dispose()
con = Nothing
cmd = Nothing
_______________________________________________________
.aspx
<Columns>
<asp:BoundColumn DataField="Listing_Id" HeaderText="Listing"></asp:BoundColumn>
<asp:BoundColumn DataField="No" HeaderText="No"></asp:BoundColumn>
<asp:BoundColumn DataField="Item_Category" HeaderText="Category"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Description">
<ItemTemplate>
<asp:TextBox id=TextBox1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Item_Description") %>'>
</asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtitem1" runat="server"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Price" FooterText=" 10/50">
<ItemTemplate>
<asp:TextBox id=TextBox3 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Price") %>'>
</asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtprice1" runat="server"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Remarks">
<ItemTemplate>
<asp:TextBox id=TextBox2 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Remark") %>'>
</asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtremark1" runat="server"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Consumption">
<ItemTemplate>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Consumption") %>'>
</asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtconsump1"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Value">
<ItemTemplate>
<asp:TextBox runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Value") %>'>
</asp:TextBox>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox runat="server" ID="txtvalue1"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
View 38 Replies
Aug 14, 2010
I'm using a stored procedure to dump some data into a sql 2008 db. The sp calls a couple of other sp's and it is one of these that is throwing the error 'Operand type clash: uniqueidentifier is incompatible with int'I've stepped through the sp in enterprised studio and entered the values mannually and the last table updates as desired.I've also stepped through the aspx page and all values are passed in ok.
[CODE]...
View 1 Replies
Mar 27, 2011
I see two means of working with session data in ASP.NET MVC:
System.Web.SessionState.HttpSessionState, available on HttpApplication
System.Web.HttpSessionStateBase, available on Controller
Data stored in one seems to be available in the other. Unfortunately the only common ancestor of these two types is System.Object, meaning that I can't create reusable utility code for the abstraction of either.Why is the API this way? Is there an important difference between the two that I am missing?
View 1 Replies
Aug 28, 2010
A ModalPopupExtender works fine with a panel as the target control and the panel has an AsyncFileUpload control.
However as soon as AsyncFileUpload.OnClientUploadComplete is set to something (e.g. onclientuploadcomplete="alert('hello');"), the panel is not hidden on page load.
Is there any compatibility issue here?
View 19 Replies
Apr 3, 2010
I am encountering an error when attempting to log into a web app (via a login page) on one of my servers. The web app is an IMAP4 client under development that should connect to the mail server currently running on the same machine. I am successful at connecting to the mail server from my development workstation running an IMAP4 desktop client under similar development.The error is... An address incompatible with the requested protocol was usedThe login page works fine in my development environment on my local workstation (connecting to the local mail server). A little research suggests the error has something to do with IPv4 vs IPv6 addressing, but I'm not sure. I have 2 network adapters in this server, for each of which IPv6 is not enabled. I have successfully reset the TCP/IP stack on the server (netsh Winsock reset) but still the error returns. Only one of the adapters is enabled and being used.
View 4 Replies
Feb 15, 2011
Following Query giving error, Please let me know whats prevent from getting this error.
declare @EmployeeID int
set @EmployeeID = 454655
DECLARE @XMLCONTENT XML
SET @XMLCONTENT = N'<EmployeeID> <Data ID="'+ CONVERT(nvarchar(100),@EmployeeID) +'"/> </EmployeeID>'
print @XMLCONTENT
View 3 Replies
Jan 25, 2011
I'm working on a DotNetNuke module in C#, and in order to cut down on the amount of complexity I have elected to try and keep the configuration of the module in one page (other than the standard Settings module). I now wonder how wise of an idea that is.My module is a simple image gallery, with one or many images. Each image has a title, an image source (url) and a destination (another url). Therefore, I figured that for my admin interface, I could have a simple 'grid' of data where you can edit all of the existing entries or add a new one, all on the same page, sort of like this:
Title Image URL Anchor HREF
[A Picture! ] [http://www.example.com/image.jpg ] [http://www.example.com]
[Another Picture!] [http://www.example.com/image2.jpg] [http://www.example.net]
[ ] [ ] [ ]
Looking through WebControls, I found the GridView, which at first blush seemed like the sort of thing I was looking for. However, taking a closer gander at it, I found that it needed to be bound directly to a data source, while it seems like the DotNetNuke standard of doing things in the Data Access Layer is to create a collection of data objects like so:
// EditDiscovery.ascx.cs
DiscoveryController objDiscoverys = new DiscoveryController();
List<DiscoveryInfo> lstDiscoveries = objDiscoverys.GetDiscoverys(ModuleId);[code]....
Is there something I'm missing with the GridView, or should I be changing the GetDiscoverys function to return a DataSet as opposed to a List of DiscoveryInfo objects? Or is there a better approach that does things that align better with DotNetNuke's DAL?
View 2 Replies
Dec 4, 2010
Here is the code:
Code:
Dim intusercount As Integer = 0
Using connection As New SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True")
Using command As New SqlCommand("SELECT [ID] FROM [Members] WHERE [Username]=@Username AND [Password]=@Password", connection)
command.Parameters.Add("@Username", Data.SqlDbType.VarChar).Value = TextBox1.Text
command.Parameters.Add("@Password", Data.SqlDbType.VarChar).Value = TextBox2.Text
connection.Open()
intusercount = command.ExecuteScalar
connection.Close()
If intusercount > 0 Then
MsgBox("Good")
Else
MsgBox("Bad")
End If
End Using
End Using
Error:
The data types text and varchar are incompatible in the equal to operator.
Source Error:
Quote:
Line 11: command.Parameters.Add("@Password", Data.SqlDbType.VarChar).Value = TextBox2.Text
Line 12: connection.Open()
Line 13: intusercount = command.ExecuteScalar
Line 14: connection.Close()
Line 15: If intusercount > 0 Then
Stack:
Code:
[SqlException (0x80131904): The data types text and varchar are incompatible in the equal to operator.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2030802
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009584
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2275
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +86
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteScalar() +139
_Default.Button1_Click(Object sender, EventArgs e) in C:UsersUserDocumentsVisual Studio 2010WebSitesWebSite13Default.aspx.vb:13
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Database:
View 2 Replies
Feb 4, 2010
I have a website that's developed in ASP.NET and uses the AJAX Toolkit (asp:ToolkitScriptManager) for a couple of extenders. The AJAX effects (e.g. ) work perfectly across IE 7, IE8, FF3.5, Safari, and Chrome. However, I embedded my site in a desktop Flex-AdobeAir application using the component which is able to run the entire site including javascript except where the AJAX is used.
I narrowed the source of the problem down to the difference between using asp:ToolkitScriptManager and asp:ScriptManager. Here's an example page that will display "Safari" in the embedded flex browser as the result of document.write(Sys.Browser.name):
<%@ Page Language="C#" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[code]...
However, if you change
<asp:ScriptManager ID="TheScriptManager" runat="server"></asp:ScriptManager>
to
<asp:ToolkitScriptManager ID="TheScriptManager" runat="server"></asp:ToolkitScriptManager>
it suddenly does not display anything on the flex browser.
View 1 Replies
Mar 6, 2011
My table contains a column named visitorimage with image as the datatype. I have a stored procedure to insert an image but whenever I try to create the sp an error occurs saying"Operand type clash: nvarchar is incompatible with image". What's the problem and how to fix this?
ALTER PROCEDURE [dbo].[usp_addvisitor] @lastname nvarchar(50), @firstname nvarchar(50), @visitorimage image, @gender char(6), @personalid nvarchar(50), @vehicleno nvarchar(20), @company nvarchar(50), @represent nvarchar(100), @phonenumber bigint, @mobilenumber
bigint, @address nvarchar(100), @remarks nvarchar(200) AS INSERT INTO tblVisitor VALUES (@lastname, @firstname, @visitorimage, @gender, @personalid, @vehicleno, @company, @represent, @phonenumber, @mobilenumber, @address, @remarks)
View 3 Replies
Nov 10, 2010
So admitingly I am fairly new at .NET...I have been a PHP guy for rather long time...
Heres my code:
[code]....
Essentially what I am trying to do is query the SQL database by the username. This above code is a method within the user respository for fetching a user by their username. The variable "username" is passed in as a string.
When the method is called a recieve the following error:
The data types text and varchar are incompatible in the equal to operator.
This to me is rather confusing since the field in the database, user_username, is a text and the variable passed in, as said, is a string. They should be synonomous for all practical purposes.
Ideas? Thoughts? Fixes?
View 2 Replies
Dec 23, 2010
I usually use WebMatrix to manage my database (sdf file). I wonder if it can be possible to manage this database with SQL Management Studio 2008? When I try to open it with SQL Management Studio 2008 I get the error:
Incompatible database version. What's wrong?
BUT When I create a new sdf database with SQL Management Studio 2008, I have no problem for open it again with SQL Management Studio 2008 but if I try to open it with WebMatrix it doesn't work...(server not found?)
View 1 Replies
Mar 16, 2011
I've found a lot of similar topics but none of them solves my problem.
I have table structure like that
[Code]....
Everyone suggests to change ntext type to nvarchar(MAX) and life will be beautyfull. But... First, I need
ntext, simply because there should be text in this field.
nvarchar(MAX) equals 4096 bytes which is to small for large text. Second, I already have table with
ntext field, which does not cause this error.
View 2 Replies
Jul 4, 2010
I get the following error: The data types text and varchar are incompatible in the equal to operator.here's my code (PageName is a string Parameter) :
SqlConnection sql = SQLconnection();
en();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "Select title, text, postdate, sticky from articles where pagename = @pagename;";
[code]...
View 2 Replies
Feb 22, 2011
I have a datatable which i get from the databasemanager class, and i would need to transform that data into a hierarchical structure
either binding it directly to a .net treeview control or in memory first .
i have an ID column, and a ParentID column.what i do not know necessarily is the parent ID to start with. so first thing to do would be to find out which node is the parent ID.
what would be best practice to loop over this table and make it hierarchical
BranchId ParentId ProductCount HasBranchChildren Name
0 NULL 48 1 Categories
1 0 20 1 CategoryA
2 1 10 1 CategoryA1
3 1 8 0 CategoryA2
4 1 2 0 CategoryA3
5 2 4 0 CategoryA1.1
6 2 6 0 CategoryA1.2
7 0 28 1 CategoryB
8 7 20 0 CategoryB1
9 7 8 0 CategoryB2
this would be an example datatable of course it will have hundreds of items, and it does not always start at the root node, its possible that with a request a certain subset of categories is requested, however i've talked with the database team and they will give me NULL on root nodes in the above example that would be element 0 in the table ....
View 2 Replies
Aug 13, 2010
I just finished making a change to an ASP.NET Ajax screen from a few years back. It was harder than expected to build and maintain. On this change, I estimated 12 hours and spent 4 days. Granted I also did extensive refactoring to simplify the code. This is actually some pretty fun code, but I wonder if there was a better route for the original implementation than the one I took. To start, here's a screenshot:
The Problem So obviously this is an editable tree of data. The data behaves very differently at each level -- very different sorting/collision rules and so on. My solution is actually performant and provides an adequate user experience, but it's nearly 2,000 lines of code spanning 11 classes, which is more than I envisioned going in. I'm curious if you've solved similiar problems and if you were able to find a simpler solution. It looks pretty straightforward at a glance, maybe that means I did something right. But there is some real complexity here -- obviously you can add and remove items at three different levels, and everything sorts similiar to a netflix queue, but with quirks. It also has to detect collisions on the various entities (in the image, if you changed day 5 to day 1, it would have to figure out which one is actually day one and move the other one).
The biggest problem was keeping track of the state, since users don't want to commit changes to the database as they work. I thought it might be possible to use the actual controls (nested repeaters in this case) to represent this interim state, but that ended up being a dead end due to complexities related to the underlying data. The Solution To solve this, I created a full blown XML representation of all the data, which was actually great in some ways since I was able to use LINQ to do a lot of heavy lifting around sorting and querying. Still, there is a lot of code in here related to syncing up the xml to the html and so on, and I had to make a pretty hefty abstraction on top of the xml to make it easy for me to work with it in code. In case you're interested, I am currently persisting the XML to session state so that it will survive across callbacks, but eventually that should go into the database.
One colleague told me it would be better to use Flex or maybe Silveright for something like this, and I think that might be true since those are both much more stateful, although Silverlight was not ready for prime time back when this started, and I don't know Flex. Maybe using a temp table instead of xml would have been superior in some way. I'm looking to learn and improve -- what have your experiences been with this type of problem?
View 1 Replies
Mar 15, 2010
I'm looking at building a facility which allows querying for data with hierarchical filtering. I have a few ideas how I'm going to go about it but was wondering if there are any recommendations or suggestions that might be more efficient.
As an example imagine that a user is searching for a job. The job areas would be as follows.
1: Scotland
2: --- West Central
3: ------ Glasgow
4: ------ Etc
5: --- North East
6: ------ Ayrshire
7: ------ Etc
A user can search specific (i.e. Glasgow) or in a larger area (i.e. Scotland).
The two approaches I am considering are:
keep a note of children in the database for each record (i.e. cat 1 would have 2, 3, 4 in its children field) and query against that record with a SELECT * FROM Jobs WHERE Category IN Areas.childrenField.
Use a recursive function to find all results who have a relation to the selected area.
The problems I see from both are:
Holding this data in the db will mean having to keep track of all changes to structure.
Recursion is slow and inefficent.
I'm using C# ASP.NET with MSSQL 2005 DB.
View 5 Replies
Mar 2, 2011
Site.Master file contains
<ul id="nav">
<% Html.RenderAction("Menu", "ShoppingCart"); %>
</ul>
[ChildActionOnly]
public ActionResult Menu()
{
// for to geenrate menu ?
return ????
}
How to generate hierarchical menu below in Menu method from database data ? Should I use stringbuilder or is there better way ?
Resulting html shoudl look like:
[Code]....
View 64 Replies
Sep 15, 2010
i added a collection of data into a list box. i have another group of data with a group name.i want to add this group in to that same list box as a tree structure.
the sample list box is shown below.
item1
item2
item3
-group name
group item1
gruop item 2
gruop item 3
item 4
item 5
is there any way to do this. when clicking on the group name it must be expanded within the list box and i want to manage all these elements with an index.
View 3 Replies
May 7, 2010
I have three level hierarchical data. using the statement below i managed to display two level data. I need to extend it to one more level.
Current hierachy is Modules-->Documents
I need to extend it as Packages-->Modules-->Documents
var data = (from m in DataContext.SysModules join d in DataContext.SysDocuments on m.ModuleID equals d.ModuleID into tempDocs from SysDocument in tempDocs.DefaultIfEmpty()
group SysDocument by m).ToList();
View 2 Replies
Mar 21, 2010
I have a table in SQL Server 2005.
I want to show all domain name in a dropdownlist maintaing the same hierarchy. i.e
Law
Engineering
--civil
--Mechanical
Medical
--Dental
----Cavity
--MBBS
I need to append '--' according to the domain level. Is it possible using a sql query. or alternatively can I have any other control to show this data.
View 3 Replies