.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

Setting a default value for a Unit type parameter

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :Windows Application

I want to include an optional parameter in a function statement that is of the type Unit. For example:

Public Shared Function NewTable(Optional ByVal TableWidth As Unit) As Table

Optional parameters require a default value, but I cannot figure out how to set a default value for a Unit type. Help! Thanks!

View Complete Post

More Related Resource Links

Setting the default start page in godaddy hosting?


 How do you set the start page with godaddy hosting? I can see no way of doing this! You do not seem to have access to the IIS settings that allow you to change it!

type object parameter



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

Setting default localization



I ever thought that I can set a default localization if the users one (which is set in the browser) isn't available.

I've implemented my localresource files for localization. The start.aspx.resx contains all texts and elements for German use and the start.aspx.en.resx for English users. When I switch the language in the browser settings from German to English everything works fine and the english text is displayed. But when I switch to an other language which is not German or English, it takes defaulty the german resource files.

I've set

UICulture="auto:en-US" Culture="auto:en-US"

as well, but it didn't assume the .en resource file automatically. (For example when I enter the website and switch the browser language to French or Italian it should take the english resource files.)

Thanks and regards,

Read an XML file, setting uname/pw, Accept, Content-Type

Hi; To read some REST XML data we need to set the username, password, and tell it for the http request Accept: application/xml Content-Type: application/xml Is there a sample anywhere showing how to do this? thanks - daveVery funny video - Reporting as a Metaphor

ssrs 2008 R2 - report parameter with no default set throws java script error

We have recently upgraded from SQL Server 2008 to SQL Server 2008 R2....I am experiencing a problem with my report parameters on my SSRS reports. It seems that my report parameters that I do not have a specified 'default' value throws a java script error when I try and run/render the report under R2.  As soon as I put a 'default' value on the report param, everything is fine.  However, that is not the behavior we need for our reports...the user needs to pick their selection. Can anyone shed some light on this, it seems to be an AJAX problem...I need to be able to have report parameters with a list of values, but no 'default' value on the parameter.

Setting Managed MetaData default values on site creation

I am working on a project where the requirement is to have specific document content types.  I have therefore create a site columns feature which creates all my columns, I have a Site Contentypes feature which creates all my content type and I have list templates based on my content types.  I also have created a couple of Site definition features which create specific list instance based on my list template As part of my content types I have created a few Managed Metadata fields which I wanted to set defaults for on the creation of my sites.  I have therefore created a feature which is right at the end of the WebFeatures section in my ONET.xml.  This features enumerates through all lists, looking for specific column names(managed metadata columns) and looks to set these to specific values.  The code to set the default value on the field is: TaxonomyField documentCategoryField = (TaxonomyField)library.Fields["Document Category"]; if (documentCategoryTerm != null) { documentCategoryField.DefaultValue = documentLibraryDefault.ToString(); documentCategoryField.Update();                                                     }                         &n

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>?

What lists and what column types allow for setting "column default value settings"

There is a new setting for lists in 2010 called "Column default value settings". What lists does this setting apply to (I think just lists with a base template of Document Library)? And for what column types is it available? It was available on a "Single line of text" column but not a lookup column. Thanks in advance!

Setting ASP Parameter value from a variable

I create a variable in code behind to save today's date.Dim date1 As New DateTime date1 = Now() And I want to save it as a parameter for an accessDataSource but I'm not finding anywhere that tells me how to do this properly. My attempts thus far have been<asp:Parameter DefaultValue="<% Response.Write(date1) %>" Name="date1" Type="DateTime" /> <asp:Parameter DefaultValue="date1" Name="date1" Type="DateTime" /> <asp:Parameter DefaultValue=date1 Name="date1" Type="DateTime" /> None of these are working! What is the proper way to do this?

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?

Content type default value

I have created a project site template with a number of site content types. I have a list, Project, with a number of details including a field called Number. This list has one entry only, with one project number. The top level site content type has a field called Project Number. Is there any way that, when opening a new file based on the site content type that i have created, the Project Number field in the content type will have a default value of the field called Number that resides in the Project list?   Any ideas?

Load View and Partial View (Master/Detail) with default parameter(s) ?

MVC newb.  Members view (index) that lists members that users can select to show a partial view in the same view with details for the selected member Uses jquery (Ajax.ActionLink) to call a partial view method in the members controller to then load the members detail section Works fine up to here....but I'd like to load the partial view with "member" details for a default or random member on initial load -- ie not through the Actionlink selection How do I invoke the partial view method on the initial load?  I'm sure this is basic stuff but still still getting my head around the mvc "way" Can someone point me to an example or explanation somewhere?  (not turning anything up on my searches thus far)   thanks in advance!!

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

In a SQL2005 Reporting Subscription I need to revert the parameter back to the default value "overri

Hi, In a SQL2005 Reporting Subscription I need to revert the parameter back to the default value "override-default." This value was updated to a specific value and now I am unable to have the report updated daily with the new data.  Within Report Manager, drill into the specific report, click on the properites tab, and chose the second link on the left "Parameters."  For the value in question (DataID) someone unchecked the "Has Defalult" button.  This results in the "Use Default" check box being removed from the UI in the Subscription tab.  I can get the Use Defalut box back by entering a specific value in the 'defalut value' but the report runs against that one value (instead of updating daily.) Before the "Has Defalult" was unchecked, the Defalut Value is a buttton, which says "Override Defalut."  It is this 'button' that I am trying to get back. I've googled this and looked thru MS kb without luck.  (I think it maybe a matter of using the right language...) Thank you for your reply.   Victoria  

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

RsClientPrint add-on does not hold Default Printer Setting

 The default printer paper size is A4 in user PC but when the print icon is pressed in the report viewer control, the paper size is shown as Letter. Is there any way to capture the correct paper size as per the default printer?   Thanks,

Report Parameter type for a list of Employees to prompt like AJAX Textbox intellisence when the user


Hi All,

I have around 300 employees report to run for a specific employee, I cannot have a Dropdown as it would be too long for the report user to choose from. Is it possible in SSRS 2008 to have a text box that would provide intellisence like AJAX textbox and provides user with Employee name to choose from database or is there any other better way to select the right mployee name to run this kind of report. being a newbie to SSRS I am unable to go furthur on this. All help is great help. Thanks in advance for responding.

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