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

Top 5 Contributors of the Month
Post New Web Links

How to add WebMatrix default parameters?

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
That subject may not do this questions justice.I am trying to limit what I write on all my .cshtml pages.For example, on everypage I am @using myDLL and "connecting" to sql server.I write that out like @using System.myDLL; @{ myDLL dll = new myDLL(); dll.ConnectionString = "blablabla"; } How can I remove the need to do that to every single page? I think I can create a web.config and do some funky stuff... can someone show examples?

View Complete Post

More Related Resource Links

Replication stored procedures not being passed parameters- default appears instead

Hi I am setting up transactional replication from Oracle to SQL Server, it is working fine for 9 tables, but for one it fails on updating and deleting with a message like this: Procedure or function 'spu_VGSM_SUBMISSION_CONTACT' expects parameter '@pkc1', which was not supplied. This is correct, in that the sp should be being passed this parameter, but when I do a trace it will show something like: exec "spd_VGSM_SUBMISSION_CONTACT" '12-3456-10','BLOGGS','S', '2010-07-01 12:43:43', 'M123456' default In other words, the old primary key values which should be being passed in are being replaced with "default". I am using the CALL syntax for the update sp. If anyone can suggest why this is I would be very grateful. This is the publication: exec sp_addpublication @publication = N'_Submission_Contact', @description = N'Transactional publication from Oracle Publisher.', @sync_method = N'concurrent_c', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'false', @enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21, @ftp_login = N'anonymous', @allow_subscription_copy = N'false', @add_to_active_directory = N'false', @repl_freq = N'continuous', @status = N'active', @independent_agent = N'true', @immediate_sync = N'

InfoPath 2010 Not Allowing Default Parameters Anymore?

It appears that InfoPath 2010 no longer allows you to set the default parameter values for secondary WebService data sources before they are automatically called during the form startup. When you set up a secondary data source to a standard web service call that takes parameters, you get prompted for the sample values.  However, when you run the form, these sample values are not sent to the web service, as you would expect. Furthermore, because the secondary datasource is automatically called when the form starts up, you are not able to set the values before the automatic call because the rules processing occurs AFTER the initial call to the web service. I realize that I could do this in code in the Startup routine, but the problem is that we have users who want to stay away from coding and want to use the functionality of InfoPath and it's "easy to use interface" to be able to create forms.   Now I have to tell them that they need to start to learn C#? Am I doing something wrong here?    Or is this a big oversight on this release of InfoPath? Microsoft: If you are listening...could you please comment on this?   I would consider this a bug.

Parameters with DBNull.Value becomes "default" and causes error in SqlServer


Hi, I have a table with a nullable column.

When I try to insert a record using INSERT statement I pass a parameter set to the value DBNull.Value.

Then I get an error from the SqlServer saying that the parameter was not supplied.

Using Sql-profiler i see that the applied parameter is set to the keyword 'default'.

I try to run the query inside Sql Server Management Studio, it looks something like this:

exec sp_executesql N'INSERT INTO [tbl] ([Val1]) VALUES (@Val1_P)', @Val1_P=default

First, why is the server giving the error about parameter not supplied? I have supplied it, and the value is keyword default.

Then I try to change the query to setting @Val1_P=null. This works..

BUT the problem then is, how do I set this from ADO Command object? I have set the parameter to DbNull.Value, and it translate it to 'default'.. What's going on here? I wanted the parameter to be the keyword 'null' not 'default'.

Any suggestions? Thank you in advance!

show search result as default parameters when initiation of business data list



I want to show search result as default parameters when initiation of business data list.

Is there any solution to solve this problem. Thanks.

Setting default parameters in dataset-populated pick lists


Visual Studio 2008 with R2 added. At this point I'm only using Preview (undeployed reports).

While I can easily set a parameter when the user has to supply a value for the report parameter, it is not at all clear how to set the defaults (and expect them to work) when setting the Available Values to be populated from a DataSet--with or without multiple values. I have seen the suggestion to use the pick-list dataset as a way to populate the default values list but this does not work.

I understand how to create a query that can accept "all" as an alternative input parameter to return all rows from the product, but shouldn't we be able to selectively choose from the list of valid parameter values by adding them as values in the list of defaults?


William Vaughn
Mentor, Consultant, Trainer, MVP

"Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)"

Please click the Ma

How to apply View filtering with FilterField and FilterValue parameters by default



My list's default View (AllItems.aspx) displays a column 'Status', and I would like to automatically filter this column by default so that when a user navigates to AllItems.aspx, this column filter is already applied.

In other words, in my view AllItems.aspx, if a user clicks on the column header for 'Status' in the list view to only show Active items, the list url would be AllItems.aspx?FilterField1=Status&FilterValue1=Active

Can anyone suggest how I could automatically add the URL parameters FilterField1=Status&FilterValue1=Active to my AllItems.aspx automatically whenever this view is loaded? Perhaps could I set these variables on page load via Javascript or JQuery? Ideally I would like to 'intercept' the page, check if these parameters are undefined and if so then set them, rather than posting back. 

I realise I could achieve the same result by just editing the View query to filter on Status equals Active, however like this the user can choose to clear the Status filter if they want to without the need to edit the View's query.


Nicholas Demos

SqlDataSource WHERE Parameters - QueryString and Default value not working correctly?


This is really easy, but I can't seem to get this working correctly...


When using SqlDataSource and press on Configure Data Source, I have selected my data source.

I have selected * all records and pressed the WHERE button  (so it starts to bulld a query).



I have set the following values:


Column: NewOrUsed (only contains 1 of 2 values, either "New" or "Used")

Operator: =

Source: QueryString

QueryString Field: (Eval("NewOrUsed").ToString)

Default Value: New



However it doesn't seem to work, always returns no records even though I know there are a number of records matching "New"



What am I doing wrong?

Linq: how to share parameters between lambda expressions ?

When using Linq to objects, you will quickly feel the need to pass some parameters from a method to another but it's not so easy because each Linq method is not calling the following one. In a Linq sequence, each method is using the result computed by the previous one. So, local contexts are not visible from one method to another.
The compiler is using two technical different ways to let parameters go out of a method.

Default ASP.NET Architecture

In providing an architectural approach, some assumptions are made concerning the project goals. These assumptions should be used as a litmus test to determine if the described architecture may be an appropriate fit for your ASP.NET application.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

view state vs request parameters


If  the view state is the data entered into the form fields then they are supposed to be available in the request parameters or request body. Then why would we need view state for?


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!

default constructor SelectList




dont have a  default constructor

new SelectList() :(

Webmatrix error


When i try to do anything in webmatrix it shuts down.   i get this error in the log

pplication: WebMatrix.exe
Framework Version: v4.0.30319
Description: The application requested process termination through System.Environment.FailFast(string message).
Message: Unrecoverable system error.
   at System.Environment.FailFast(System.String)
   at MS.Internal.Invariant.FailFast(System.String, System.String)

DatabaseHelper for WebMatrix


After some initial trouble with database editor in the beta version of Microsoft WebMatrix, I decided it would be better to create SQL scripts and run them at startup of my web-app. Perhaps the Microsoft.Data.Database helper can be extend to support similar scenarios?

Here is the code: http://www.forkcan.com/viewcode/231/DatabaseHelper-for-WebMatrix

Keyboard shortcuts stops working in WebMatrix


I'm often experiencing that keyboard shortcuts stops working in WebMatrix. This is very annoying as CTRL-S, CTRL-C, CTRL-V, etc. stops working, all of which are heavily used when programming. It's obviously hard to explain how to reproduce this, but I was wondering if someone knows a quick-fix?

WebMatrix shorthand coding?


Will there be support for shorthand statements?


@if(1==1) @: works
@else @: doesn't work

as apposed to;

    <text>doesn't work</text>

Or perhaps ternary opperators? PHP like stuff ...

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