i would like to call the external js file's function onclientclick event, but how can i pass the parameter, which i get from the hidden field value from the same aspx file.
I am using hidden fields to save some preset data, but upon postback they appear to disappear.
Here's what my controller actions look like:
[Code]....
The view is coded like this:
[Code]....
But when the POST action receives the object back, some of the fields have become null. The FormCollection, however, contains all values. I realize I could just take everything from the formcollection but it's probably better practice to use the object, right?
Public selected_Month As String Public Property Month() As String Get Return selected_Month End Get Set(ByVal value As String) selected_Month = value End Set End Property
form1: where i am assigning a value
Dim my_Class As New Class1 my_Class.Month = ddl_Month.Text.ToString() form2: where i am geting a value Dim my_Class2 As New Class1 MessageBox.Show(my_Class2.Month.ToString())
when i run this code, i am getting error like Object reference not set to an instance of an object.
I stucked at a condition , where i need to share values between the pages. I want to share value from Codebehind via little or no javascript. I already have a question here on SO , but using JS. Still did'nt got any result so another approach i am asking.
So I want to know can i pass any .net object in query string. SO that i can unbox it on other end conveniently.
Update
Or is there any JavaScript approach, by passing it to windows modal dialog. or something like that.
What I am doing
What i was doing is that on my parent page load. I am extracting the properties from my class that has values fetched from db. and put it in a Session["mySession"]. Some thing like this.
Session["mySession"] = myClass.myStatus which is List<int>;
Now on one my event that checkbox click event from client side, i am opening a popup. and on its page load, extracting the list and filling the checkbox list on the child page.
Now from here user can modify its selection and close this page. Close is done via a button called save , on which i am iterating through the checked items and again sending it in Session["mySession"].
But the problem is here , when ever i again click on radio button to view the updated values , it displays the previous one. That is , If my total count of list is 3 from the db, and after modification it is 1. After reopening it still displays 3 instead of 1.
I am doing a project in ASP.NET MVC in which I want to implement an IoC container. I am new to IoC containers and have been searching to find a solution to my problem, but so far to no avail.
The problem is dat data is distributed across various databases. Once a user is logged in, the database for the user is retrieved from an authorization database and then set in the user session. That user session is passed on to the services and repositories when they are constructed, so they can use it when they need it to access the database.
A typical bare stripped service (without interfaces and ioc) looks like this:
private CompetitionRepository _CompetitionRepo; public CompetitionService(DataContext dataContext) : this (new CompetitionRepository(dataContext)) { }
[code]...
The "DataContext" contains a couple of properties with which the correct database is selected for the session. Because the Services and Repositories don't have access to the session itself (which is outside of their scope) they need this object.
i have 10 classes and i want to send the class in a paramenter dynamically to call a method for example int addmember(aslogic.base obj) smilary i want to pass class in the parameter.
I want to write a webservice, and in one of its methods, I want user to pass one my object's instance as parameter. It will greatly reduces number of parameters, and help user call this method more effectively. I create some class, but when distributing them to client, only class name remains, all properties and methods are gone, just like this
public class CameraPackages { private readonly List<CameraPackage> _packages; public CameraPackages() { _packages = new List<CameraPackage>(); } public void AddNewCamera(CameraPackage package) { _packages.Add(package); } public void RemoveCamera(CameraPackage package) { if(_packages.Contains(package)) _packages.Remove(package); else throw new ArgumentException(); } } into this: (in Reference.cs) [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")] public partial class CameraPackages { }
I need to use this data as an input to ajax request. For eg. consider a dropdownlist change event, I need to pass these values to the controller.
sample code
//dropdown change event $("#TestReqID").change(function() { var id = 10; var testResults = "abc"; var inXML = "<xml>"; inXML = inXML + "<id>" + id + "</id>"; inXML = inXML + "<value1>" + testResults + "</value1>"; inXML = inXML + "</xml>" $.getJSON("/Home/UpdateTest/Json/" + inXML, function(data) { //success code goes here }); });
in HomeController
public ActionResult UpdateTest(string obj) { if (HttpContext.Request.IsAjaxRequest()) { /* Need to parse data in "obj" from ajax request */ IPTests test = _service.GetIPTest(Convert.ToInt32(id)); return new JsonResult { Data = new { ipTestId = "0", testResults = "" } }; } return View(test); }
instead of xml string is it possible to use javascript object like
I developed a C# web application that calls a web-service which returns a base64 encoded array (PDF file). I then convert that array into a UCOMIStream object (I know it is obsolete, but the DLL that I am using requires it as a parameter). I use the following code to do the conversion which works perfectly. I can pass this object to the DLL so that I can print the PDF.
This works great on the Webserver, but the requirement is to print it locally.
Byte[] bBuffer = statementOut.statementcycle.statementdata.content; int size = bBuffer.Length; IntPtr mem = Marshal.AllocHGlobal(size); Marshal.Copy(bBuffer, 0, mem, size); // Create an OLE Stream object. System.Runtime.InteropServices.UCOMIStream str; //obsolete but the createstreamonhglobal outputs it CreateStreamOnHGlobal(mem, true, out str);
The DLL resides on the client so I am able to use ActiveX to create the object using javascript and/or VBscript;however, I have not been able to figure out how to get the stream object to the client to pass to the DLL.
I am trying to pass a sql connection object by reference ("ByRef") like so but when I'm inside the function that i'm passing it to it sees the connection as closed, what am i doing wrong?
I have a web service Writed By VB.net Lang return a DataSet Contain many rows , I tried to Call this Web Service From Java applicationput Java Language cant Deal with dataSet , So I need to Convert the Dataset to an Object
<WebMethod()> _ Public Function GetLogBook(ByVal EmployeeNumber As String, _ ByVal EmployeeName As String) As DataSet Dim ds As New DataSet Dim conn As New [code]...
First, we are constrained to using an existing web framework that handles authentication and authorization. The web project uses forms authentication and writes to an encrypted cookie. The user information is exposed to the aspx pages as a property:
LoggedInUser.Current
This has several properties including the userId and role list.
I've looked at using initParams, but haven't been very successful there (edit: I couldn't do it dynamically originally). I've created a simple POCO entity with a [Key] attribute, but I need to at least be able to pass the userId from the aspx page to the imbedded silverlight.
What is the easiest way to pass a dynamic object from aspx to silverlight 4?
[Code]....
Then used Slugster's example to use the values on the Silverlight side.
Warning: Passing user information via init params exposes the info as plain text to the user viewing the page (they just have to view the source). We ended up using an authentication domain service and using the same user object as the aspx
Let us assume the following relationships (diagram). A FundCompany has Funds, and Accounts. There is also a FundAccount which creates a many-to-many relationship (as well as other attributes at the relationship level) between Accounts and Funds. Lastly an Account has one or more Beneficiary.The FundCompany is an aggregate root as it's at the top of the pyramid. Neither Account nor Fund can exist without the FundCompany. FundAccount cannot exist without both Fund and Account; does that make them both aggregate roots? Or is Fund still the only aggregate root, having to go through it to perform operations on FundAccount entities? The fact that the Account also has Beneficiaries, which cannot exist without the Account, does that also signal Account being an aggregate root?
All of the entities on this diagram will require CRUD operations and screens in my application. The reason I'm bringing this is up is most often every UI screen will store the ID of the row/entity it's referencing. So for example a user clicks "Details" on a table with Funds, I might need to retrieve a fund via its ID. My understanding is that if an entity needs direct access then it's an aggregate root in itself. However this would make a lot of entities aggregate roots by default.Based on the answers to above questions I have to map these operations to the proper aggregate root's repository.
But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.
I'm using urlrewriting to rewrite my url. Let me introduce my problem by bellow example: Here is old url: http://localhost/test/pages.aspx?pageid=1 I have 2 cases to rewrite: