This should give me the friends of the user currently logged in in the Repeater, but gives me an exception on the runtime that an instance needs to be initialized, can you please suggest a solution...
Also, what should be the value of the NavigateUrl property of a Hyperlink in an ItemTemplate if the url is:
"http://domain.com/viewprofile.aspx?id=" + 'THE UserID property of the current element in the list'
I have a table "OSTAN" with two columns "ID" (Key index) and "NAME". I am trying to construct a linq query to select the Name for a specific ID. I have not luck trying to construct the where clause. Here what I have so far:
using (XeledsEntities db = new XeledsEntities()) { string SelectedName = db.Ostans.Name.Where( Ostan=> Ostan.Equals(Request.QueryString["Ostan"])).FirstOrDefault(); }
Can anybody construct this where clause to set the Selected Name?
The following code works fine for converting an XML data set to be enumerable for Linq.
'Query webservice for data Dim propertyInfo As String = myService.GetProperty(userName, password, Acct) ' Create a new DataSet.
[code]...
However, it does not retain the xml tags in the Linq enumerablerable dataset ('newDataSet2"). I don't think I can rely on the array index order as being the same everytime, so this would obviously cause a problem if I'm trying to align the array items up to my database fields. How can I make newDataSet2 retain the XML tags (column headings) to insure I know what data field each array item belongs to?
I have 2 points for today I. I have a controller in which i have a public static method for getting the details for a checkbox like
[code]....
is it ok for me to use this same function like this one in the view, so that I do not need to use the viewdata object,
<%: Html.DropDownList("country", new SelectList(UserController.GetCountryLists(), "value", "countryname", "0"))%>
Also i have another query, when i use the same id & name for the radiobuttons, validation at the client side is working fine.If I use the same condition for a group of checkboxes, i get do not get the checkboxes highlighted during client validation and only during server validation, i get the error message, but the controls [checkboxes] do not have a red border indicating the error.I have used my own html helper to generate the checkboxlist as per [URL].
I'm trying to follow the demo from this link to add a jqGrid to an MVC app.
I have a table named Companies that I'm trying to display in a grid. A Company simply contains an ID and a Name.
I'm running into an error in my controller function:
public JsonResult DynamicGridData(string sortIndex, string sortOrder, int page, int rows) { int pageIndex = Convert.ToInt32(page) - 1; int pageSize = rows; var companies = companiesRepository.Companies.OrderBy(sortIndex + " " + sortOrder).Skip(pageIndex * pageSize).Take(pageSize); //Error here ... }
I'm getting an error on the line that is calling OrderBy():
The type arguments for method 'System.Linq.Enumerable.OrderBy(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
I really have no idea what the error means, and I haven't been able to find an explanation. I'm not sure what is causing this error on a simple OrderBy function.
Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net
Using the following Webservice definition using aClientArgs as a complex type:
[System.Web.Script.Services.ScriptService] public class Controller : System.Web.Services.WebService { [WebMethod] public void save_client(aClientArgs client) { // Save client data } } Then defining aClientArgs as a sub-class: public class aArgs { public string id = null; public string name = null; } public class aClientArgs : aArgs { public string address = null; public string website = null; } Returns the following WSDL fragment for the save_client args: <save_client xmlns="http://tempuri.org/"> <client> <address>string</address> <website>string</website> </client> </save_client> When I'm expecting the following: <save_client xmlns="http://tempuri.org/"> <client> <id>string</id> <name>string</name> <address>string</address> <website>string</website> </client> </save_client>
So it appears that the .NET WebService is not treating inherited properties as arguments/variables for purposes of a web service. How do I get .NET to also use the properties of the base class?
I first need to apologize in case this has been answered before but I'm a newbie (green as they come) and this error keeps popping up even before I start debugging! There are two errors and the second one is:" Error 2
Missing partial modifier on declaration of type 'WFPKenya2.WFPKenya2'; another partial declaration of this type exists"
I have this Control directive in a usercontrol (i've changed the namespace and class name):
<%@ Control Language="C#" AutoEventWireup="true" Inherits="Namespace.Path.To.ClassName" %> <asp:TextBox runat="server" ID="txtComment" TextMode="MultiLine" ValidationGroup="comment" /> ClassName is a class that lives in a class library and this is the class: namespace Namespace.Path.To { public class ClassName : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox txtComment; protected void Page_Load(object sender, EventArgs e) { HttpContext.Current.Response.Write(txtComment == null); HttpContext.Current.Response.End(); }
I'd like to inherit all my controllers from a custom base class that I write myself. I can change the line every time I add a new controller, but it would be nicer if I could somewhere specify the default value that gets set there. That way I wouldn't need to worry about forgetting this, and other people who get added to the project later on would have an easier time.
am using class diagram of visual studio 2008as you can see the image i need show to user that the period and calendar classes have the idMarket property that refers to market classhow can i do this?
I have build a UserControl with separate code behind file.In that code behind file i have defined some public properties in the Partial class of user control that was automatically generated.Those properties will initialize some properties of controls that are used in the control.Now, in .aspx page i used this User Control and initialized the public properties through code behind of aspx page for dynamic contents.
In my MVC project, I am trying to setup a base product class that will be inherited by a more specific class later. Here is my scenario. I have a table called ProductBase, it contains three fields, BaseProductId(PK), CatalogNum, and ListPrice. Every product in the system will share these attributes. Next, I have a table called Shirt, with three fields BaseProductId(PK, FK), Color, and Size.
I then setup an Entity Data Model that pulled in both of these tables and created classes BaseProduct and Shirt. So, in my model, I want to do something like this:
[Code]....
The main problem I have with this, is that if I do any kind of condition on CatalogNum or ListPrice, then my performance goes to crap. One of the main things we will want to do is something like this:
[Code]....
This takes an enormous performance hit, and I suspect it is because the partial class above returns to the database for each shirt.
The other problem I have with this approach, is that I cannot force the properties for the Shirt. What if I make a change to the BaseProduct? What happens when I have multiple product types, will I have to repeat this code? I assume I will need to make a change with the entity data model, but I am unsure where to begin.
I have a class (name PageBase) that is inhariting System .Web.UI .Page and all my .aspx page behind classes are inhariting this class. This way I have put some common things in PageBase class.
For showing errors I want to put showMessage funtion in PageBase as well so that I may have not put it in every page and it will easy to manage this way.
Probem is that how PageBase class will access a control which is in aspx page in its child class (child class of PageBase) .
I dont want to pass control as argument to function in parent class, is ther any other way ?
I am going to have multiple "types" of an object and I am really not sure how best to retrieve/save those multiple types without having a separate save/retrieve for each type.
My classes:
[Code]....
I hope this makes sense. I'd rather not add a "type" column as I have this in another part of my database and I am not really liking it too much
UPDATE
Here's more info/questions for clarification, if necessary.
I'm really at a loss for how to incorporate them into my repository pattern.
When I call getEvaluation, I want it to return an abstract Evaluation, but I'm struggling with this code. Same with Saving - any insight on this would be excellent
UPDATE 2
Database: Evaluations Id (PK) Comment EvaluationType1 Id (FK to Evaluations.Id) Field EvaluationType1 Id (FK to Evaluations.Id) Field
So, in getEvaluation(int id), I need to figure out what type of Evaluation they want. Does this mean I should pass in a type? Same is true in saveEvaluation, But I can do a switch/function map to see what Type it is.
i have an application consisting of two asp.net projects. And i have have a BasePage which inherits System.Web.UI.Page and have the class some core logic which i require in all of my pages(Implemented in BasePage.cs). So all my pages inherit this BasePage.cs . Now can an Webservice inherit the same class apart from the normal webservice class System.Web.Services.WebService
I have a class instance which is created by using Activator.CreateInstance() method. That class instance contains helper methods which are frequently used throughout the application. In order to avoid creating the instance multiple times, I'm just thinking about implementing an appropriate caching mechanism. The following consideration should be taken into account:
1) I can't use static class and methods. 2) There are around 6 instances (1 instance per class) per App Domain.
How can I to use System.Drawing.Bitmap class into athoer class?
using System.Data; using System.Collections; using System.Globalization; using System.Data.SqlClient; using System.Collections.Generic; using System.Globalization; using System.Text; namespace University { public class Class1 { System.Drawing.Bitmap BMP=new System.Drawing .Bitmap(); } }
when I use System.Drawing.Bitmap gives error this class does not exists