.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

type object parameter

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


I have a problem I can't figure out.

I've been trying to add a listbox with multi select enabled as a parameter to my select statement in sqldatasource.

So i created a function like this :

string strItemTypes = "";
foreach (ListItem li in lbItemType.Items)
   if (li.Selected)
      strItemTypes += "," + li.Value;
strItemTypes = strItemTypes.Substring(1);

which gives me the selected items like this for example : "1,2,3"...
Then I've been trying to add it to my sql select statement :

SELECT tblOfficesItems.idOfficesItems, tblStockItems.Name, tblStockItems.Description, tblStockItemTypes.TypeItem, tblStockItems.Notes FROM tblOfficesItems INNER JOIN tblStockItems ON tblOfficesItems.fkItem = tblStockItems.idItem INNER JOIN tblStockItemTypes ON tblStockItems.fkTypeItem = tblStockItemTypes.idTypeItem WHERE tblStockItems.fkTypeItem IN ( @fkTypeItems )

using a hiddenfield with a controlparameter of type=object
but it just don't seem to work, seems like the data just won't bind or something and I don't get any errors so I'm confused!!

then i tried this :

SELECT tblOfficesItems.idOfficesItems, tblStockItems.Name

View Complete Post

More Related Resource Links

Calling a method with a class object as parameter data type.

   [WebMethod]    public string GetInfo(Customer inCust)    {        // Code in here    } I have a web service that resides on a remote server. I want to call a public method of theweb service named  "GetInfo". The method is shown above. The web service method expects a class object oftype "Customer". What I did to create a Customer object was to define in my asp.net project my own class named "Customer" which is exactlythe same as the class that belongs to the web service project on the remote server. I then created an instance of Customerand tried to call the web service passing in an object of type customer : my.Service ws = new my.Service(); // Get web service connectionCustomer aCustomer = new Customer();aCustomer.Initialize();ws.GetInfo(aCustomer) // call web service passing in a Customer object The problem is that the compiler gives me the following error: Value of type '_Default.Customer' cannot be converted to 'ws.Class1'. Here Default is refering to my Default.aspx.cs code. Why is this? Do I need to Cast my "aCustomer" class object to a type ofws.Customer ? How do I do that?

Cannot convert type 'object[]' to 'byte[]'


I am doing this .. and i want to convert object array to byte array. How should I do that?

Object[] myVal = um.myData;

Byte[] byteArray = (Byte[])myVal;

Unable to cast object of type 'System.Web.Mvc.ValueProviderResult' to type 'System.IConvertible'


 Why am I getting this error on line:

               sp.Price = Convert.ToDecimal(collection.GetValue("Price"));

sp is :
  SPecials_Templates sp = new SPecials_Templates();

SPecials_Templates Defined:

    public partial class SPecials_Templates
        public class SPecials_TemplatesMetaData

            public object Key { get; set; }
            public object Template_Name { get; set; }
            public object Headline { get; set; }

Object expected error


<input type="button' onclick="timeoutCheck()" value="Click Me!" />

it tells me Microsoft JScript runtime error: Object expected


timeoutCheck() is my script function that i declared above the input tag

can anyone tell me why i am getting this error

hello i need help , any ideas are welcome i have been working on this for two weeks now and cannot seem to be able to advance

Related to Type Identifier in Object header

Hi , I have read some where that , every object created on CLR heap has Object Header and Object body. In case of c++ , we need to make destructor as virtual in case of polymorphism. Example c++ :-  class base {   virtual void Hello(): }; class Derived: base {   int *ptr;   Derived()  {     ptr=new int[10];   }   ~Derived()   {      delete ptr;    }    } This is not a compiled code. In this senario we need to make Derived class destructor as virtaul. Question is in case of CLR , we need  not make destructor as virtual. How does CLR takes care of this internally.    

How can I access a Type with generic parameter in XAML

Hello, How can I access a Type with generic parameter in XAML. class SampleClass<T> { } now in XAML: i want to access xmlns:local="Ref to SampleClass" How it will create the instance of SampleClass<T>?

How to find specific nested object type in Gridview

Dears, I have a gridview with a nested placeholder in each rows. I nested some checkboxes in each placeholders in each rows dynamically, so their ServerIDs are not the same (I dont want to use nested gridview). at the end in a button event I want to count checked checkboxes in gridview while I can not use findcontrol() method in each rows to find checkboxes due to their different ServerIDs. How can I do this?

Timer job intiation error: SharePoint cannot deserialize an object of type

Hi All, when i run a timer job (One-Time timer) it has added it to Timer Job definitions in the Central Administration. I have checked the Log file in 12 hive and found the following error..... "SharePoint cannot deserialize an object of type xyz.xyzJob, xyzTimer, Version=, Culture=neutral, PublicKeyToken=<token> on this machine. This typically occurs because the assembly containing this type is not installed on this machine. In this case, this message can be safely ignored. Otherwise, the assembly needs to be installed on this machine in a location that can be discovered by the .NET Framework." The above error says that the assembly is not added.... but it has been already added to the GAC. Can anyone guide me about the issue and how to resolve that........?

Hi.How I can to transfer data from object to parameter?

Hi to All. I have class with object wich populated with data from Users Interface  now I need to transfer the data to Store Procedure SQL but i can to transfer the data only using Parameters how I can to get the data from object and to put it in @parameter? Thanks/

Object of type Sys.UI._Time' cannot be converted to type Sys.UI._Timer

I have a main page with several menu choices, one of which launches an ajax enabled window.  The following pattern occurs: If I: 1) Launch site 2) Select menu choice listed on master page that is not ajax enabled 3) Select menu choice that launches ajax enabled popup. 4) close pages All is OK. If I repeat the steps, but in step 2 I select an ajax enabled page and them launch popup, I get the following error: Message: Sys.ArgumentTypeException: Object of type 'Sys.UI._Timer' cannot be converted to type 'Sys.UI._Timer'. I have spent days on this and have been unable to solve it.  If I remove the ajax ToolkitScriptManager and update panels from any of the pages and launch the popup, it works. Can anyone offer some guidance? that are not ajax enabled and then selethat includes an ajax enabled popup window.  T 

How to get input parameter's count and type by using MetadataImporter

I want to get each input parameter type of all operations in WCF Service via MetadataImporter, the code as below: Service Contract: it is default after you created a wcf applicaiton in vs 2010     [ServiceContract]     public interface IService1     {         [OperationContract]         string GetData(int value);         [OperationContract]         CompositeType GetDataUsingDataContract(CompositeType composite);         // TODO: Add your service operations here     }   Client Side:             string mexAddress = http://localhost:53720/Service1.svc?wsdl;                      BasicHttpBinding binding = new BasicHttpBinding();             MetadataExchangeClient MEXClient = new MetadataExchangeClient(binding);             MetadataSet metadata = MEXClient.GetMetadata(new Uri(mexAddress),  MetadataExchangeClientMode.HttpGet);          &nb

Use a generic type parameter with a GetBody<>

I have a generic messaging system which can pass any type of message around.  I have put the type of object in the Message Header so that I know when I receive it what type I need.  Is there any way to take the string that contains the name of the type and use that in the MessageReceived.GetBody<>. It would be nnice to be able to do that instead of a messy if else checking the string to know message types and then hard coding the Type in the GetBody.   Thanks in advance    needbrew

Weird Issue with the MOSS Search : FileExtension metadata object type instead of string

Hello, We 've got a strange issue with the search and especially with the FileExtension metadata. when we make a query on the search engine, we receive for the FileExtension metadata an unexcpected result. here is a printscreen showing the issue. http://cid-53eee937847a625e.photos.live.com/self.aspx/Public/Untitled.jpg as you can see the Type of the FileExtension is object and it should be string and I checked the type of the object and it's System.String[] the element at the index 0 contains the value! what's wrong ? thx in advance

How to use return JSON object from web service as a declared Type?

Hi, I just hit the following issue: I am calling a web service that returns a serialized JSON object let's say: __type, FirstName, LastName (.net object Person with properties FirstName and LastName). __type's value is Test.Person I have created a JS object using Type.registerNameSpace/registerClass called Demo.Person and it is registered on the page using the ScriptManager. Everything is working fine; I am able to get data from the server on the call back. Is it possible to make the returned object from the web service be an instance of the declared JavaScript Demo.Person class? The idea would be to call a method like result.getFullName() on the client side without having to copy all the properties. This is just a simple scenario for more complex objects.   Thanks,   Teo

How Would I Design a Trigger Based on Object Type?

I have doing some research trying to figure out how I could create a trigger or datatemplate that would react based on an Object's type, but haven't found a decent explanation. In code I could use "GetTyoe()" but I am unsure if that is possible in XAML. As a basic example, if the Object is of Type "A" I want to bind the content of a label to a certain property of object "A", but if the object is of Type "B" I want to bind to a different property. I guess the big question is: How do I determine an objects type from XAML?

Unable to cast COM object of type 'System.__ComObject' to interface type 'IRowset'


No mapping exists from object type System.Web.UI.WebControls.Label to a known managed provider nativ

 I'm making the leap to move from vb.net to C#, and I'm getting this crazy error when I try to execute one sp, set a value, and then execute another sp based on the value.   Any suggestions??? proc_GetSectionDetails is my first stored procedure.  From that, I get a value for SectionID, and then use it for the second sp called  proc_GetSectionDetails protected void getSectionContent() { SqlConnection conn = default(SqlConnection); SqlCommand comm = default(SqlCommand); SqlDataReader reader = default(SqlDataReader); string connectionString = ConfigurationManager.ConnectionStrings["123"].ConnectionString; conn = new SqlConnection(connectionString); comm = new SqlCommand(); comm.Connection = conn; comm.CommandType = System.Data.CommandType.StoredProcedure; comm.CommandText = "proc_GetSectionDetails"; comm.Parameters.AddWithValue("SubSectionID", Request.QueryString["SubSectionID"]); conn.Open(); reader = comm.ExecuteReader(); if (reader.Read()) { lblName.Text = Convert.ToString(reader["SubSectionName"]); lblDesc.Text = Convert.ToString(reader["SubSectionDescription"]); Label SubSectionParentID = new Label();
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend