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

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

Seemingly Inconsistent Argument interpretation in MVC?

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
I'm new to MVC, so I'm probably missing something silly, but I would appreciate any help I can get on this.   I have created a controller (I'm calling it ClientController), which is in charge of my Client-related operations (Getting a full list, searching, viewing details, uploading associated images, etc), and I'm trying to provide a link to change client images either from the Details of an individual client or directly from the full listing.   When I use the helper method to generate a link on the listing view, it seems to resolve correctly (passing in the ID, which is a GUID, of the client as expected), but when I try to do the same link through the details view, it tries to pass an argument of ?Length=6, and I have no idea where that is coming from.   There are two UploadImage methods within the Controller (one loads the uploading view, and one handles the post back from that view): public ActionResult UploadImages(Guid id) {...} [HttpPost]public ActionResult UploadImages(Guid? id, FormCollection forms) {...}  This is the relevent code for my Index View (which works, and which is typed for <IEnumerable<Experiment.Models.Client>>) <%: Html.ActionLink("Change Portrait", "UploadImages", new { id = item.ID })%> And this is the code for

View Complete Post

More Related Resource Links

Content page control passes as argument to javascript function


Here is the content page:


<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript" >
 function copyValue(input, output )
   ouput.value = input.value;
   return true;
 <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
    <br />
    <br />
    <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

<input name="ctl00$ContentPlaceHol

ModalPopup/UpdatePanel from codebehind, inconsistent behavior onClick


First post bear with me please:

I have a simple form with a list of linkbuttons, each fires the same onclick event which sets an indicator image.  I have a dummy button with style="display:none" which I have set as the TargetControlID of the modal.

onClick event from the imagebutton, the modal is shown via modal.Show().  The cancel button inside the modalpopup fires an event which turns off the indicator image and hides the modal via modal.Hide(). 

The events fire perfectly, it's very simple!  Although after doing some testing I noticed the modalpopup is not presented after the 6-10th cycle of clicking the open event, then clicking cancel.  The grey background appears but it is behind the main panel and the modal is either presented behind this or is just simply not displaying. 

I spent hours researching various methods, implemented the CancelControlID to see if it was somehow tied to my call of modal.Hide() that fails.

This occurs with an updatepanel only.  The behaviour is much cleaner this way, so I would hope to be able to implement this.  I have basically eliminated everything but these two events!  Please help

Code interpretation


I am a complete novice with C#.Though i know C and C++. Can someone help me interpret the below??

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
        switch (e.Row.RowType)
                /* Specifies the function of a row in a data control, such as a DetailsView or GridView control.--> */
            case DataControlRowType.DataRow:
                Fileinformation myfileinfo = (Fileinformation)e.Row.DateItem;
            case "image/jpeg":
            case  "image/gif":
            case "application/msword":
            case "text/plain":

                HyperLink mylink = (HyperLink)e.Row.FindControl("lnkView");
                mylink.Enabled = false;


How to CATCH "Invalid postback or callback argument" exception?



How can I catch this exception? I do not want it to stop my page execution. Can/Should I do that?

Server Error in '/' Application.
Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them.  If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Invalid postback or callback argument.  Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page.  For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally

MDX - The function expects a tuple set expression for the 1 argument

I have a  scenerio dimension with several different scenerios. I am trying  subtract the measure values of the descendants in one scenerio to it's cousin in another scenerio. Here is my MDX query: WITH SET [actual - forecast] AS GENERATE( DESCENDANTS([Scenerio Dim].[Scenerio hierarchy].[actual], 0, SELF_AND_AFTER), { ( [Scenerio Dim].[Scenerio hierarchy].CURRENTMEMBER, [Measures].CURRENTMEMBER ) - ( COUSIN([Scenerio Dim].[Scenerio hierarchy].CURRENTMEMBER, [Scenerio Dim].[Scenerio hierarchy].[forecast baseline]), [Measures].CURRENTMEMBER ) } ) SELECT [actual - forecast] ON 0 FROM [actual vs forecast] I get the following error message: Query (4, 14) The function expects a tuple set expression for the 1 argument. A string or numeric expression was used.

Variable/Argument Type List

Hi I wish to restrict or supply my own list of (Variable/Argument) types to a rehosted Workflow Designer. Is this definatley not possible? I have read http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/53c91c81-02cf-4eab-b43f-c3d73a03c501, where it appears it is not. I find it difficult to believe I cannot get some sort of control of how these drop downs are populated. Could someone please confirm categorically that this is or is not possible. Regards DarremDarren

Compiler difference and IL interpretation between C# and VB.NET

I've stumbled upon an issue on which I can't get my head around ... The code below compiles and works perfectly with VB.NET at the end of the line. But with C# the code does not get compiled.... In short we've got a base class, written in C#, with two virutal methods (same name, different sig) Next we have a derrived class which overrides one of those methods. The derrived class has been implemented both in C# as in VB.Net. And the end of the line we have small console application that simply calls the methods on both derrived classes. There are also two version of the console application, one in C# and one in VB.Net. The VB.Net applications compiles and works perfectly. The C# version does not even compile. We've already found a solution : change the derrived class in VB.Net and add the overloads keyword (in addition to override) and then the C# version also works. What I don't understand is why the VB.Net application worked in the first place and the C# did not... And secondly, why does the overloads keyword need to be added to solve the issue? (we are overriding, not hiding) Is that the right solution?   The base class (c#) namespace WeirdStuff { public abstract class BaseClass { public virtual string getMethodSig(int i) { return "string BaseClass.getMethodSig(int i)"; } public virtual string getMethodSig(string s) { return "str

Change Variable and Argument editor in workflow designer?

Is it possible, in Beta 2, to customize the behaviour of the editing grids use for entering data about a workflow's variables or arguments in the workflow designer?  Can I:- add my own custom column to the grid?- can I customize the variable type drop down editor? (e.g. have my own editor or otherwise filter the list of types)- can I change the "default" expression editor (and possibly remove it)?Thanks,Notre

core results web part - Property doesn't exist or is used in a manner inconsistent with schema sett

I edited the Fetched Properties section of my core results web part and added a mapped column <Column Name="owstaxIdKeyword"/> When I reload my page, I get this error: Property doesn't exist or is used in a manner inconsistent with schema settings.

Allmembers function expects a hierarchy expression for the argument, a member expression is used" er

  Hi , I have a report that was working before.  After adding couple calculated mesaure, my report is throwing the error.  Here is the query I used.  Can you please help? this was a working prototype, now it is in trouble.  Need to fix it quickly.  thanks a million   SELECT NON EMPTY { [Measures].[sales], [Measures].[%of sales] } ON COLUMNS, NON EMPTY { ([region].[country].[country].ALLMEMBERS * [Fiscal Period].[Fiscal Year].[Fiscal Year].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM [sales] CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS      

inconsistent rendering of label

Hey, I have a fairly simple WPF application (in a more complicated scenario than this test example posted here this is of importance) with one main window containing a Button, a TabControl on the outside and then one inner part containing of a GroupBox with a Grid which is supposed to display some content (actually just labels) in a rectangle: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="480" Width="640" Loaded="Window_Loaded"> <TabControl Height="440" Width="620" HorizontalAlignment="Left" Name="tabControl1" VerticalAlignment="Top"> <TabItem Header="tabItem1" Name="tabItem1"> <Grid Height="400" Width="600"> <Button Content="Button" Height="23" HorizontalAlignment="Left" Name="button1" VerticalAlignment="Top" Width="75" /> <GroupBox Header="new map" Name="groupBoxNewMap" IsEnabled="True" Margin="0,20,0,0"> <Grid Height="361" Width="580" Name="

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

less than the size of the argument list.

Hai friends, I am updating data to Database(SQL SERVER) The following  Error occurred in RunTime,                       Index (zero based) must be greater than or equal to zero and less than the size of the argument list.Please give some guide.

Passing a global parameter/argument to a workflow


I am using a hosted workflow designer to allow users to create their workflows. I would like them to be able to execute the workflow in a 'Test' mode, so I am trying to pass a parameter that indicates it is test mode.

In addition to the workflow being run from the rehosted designer, it will also be getting executed by an automated Workflow Console Application. So when the workflow is executed from the rehosted designer, it should execute in test mode. When it is executed from the console application, it should execute in production mode.

I thought I would just be able to pass a paramter indicating which mode to run it in, but the only way I can seem to get it to work is to have an Activity already on the workflow and setup the Argument for them through the designer and assign the expression prior to run time. The problem is that the user starts out with a blank workflow with no activities on it. I do not know which activity the user is going to add to the workflow, and I don't want them to have to be able to figure out how to configure arguments. It is an argument that should just always be there.

All the activities that I've made available to the user are inherited from a base class which inherits from NativeActivity. So is there anyway to dynamically bind the activities to the argument passed in at runtime in the base class?

I am invoking

Dropdownlist posted back html content,firefox alarms "Invalid postback or callback argument"


Ok probably you might have seem a dozens of post's titled "Invalid postback or callback argument" but this one is different.

Application that i am creating is simple content editor using the FCK editor.net Control (the content is HTML Encoded before saving t0 DB and then Decoded back again when displaying). just a simple drawing of of its ui is like this

DdlPages < listing the pages Whose regions/controls value can be edited> Databound

DdlRegions <listing the controls whose content can be edited> Databound on DdlPages selected index change

===========Retreived from DropDownlistRegions selected Index Change===========

txtName <a simple name for the region, user friedly identity >

==> FCK Editor <==

<Save Button> <Discard Button>


I am not such a good designer but hope you understand the UI layout.

This thing works flawless on IE 6,7,8


DropdownlistRegions holds the content to be displayed in the txtName and FckEditor. This is done by forming a custom concatenated column containing the txtName and Fckeditor(HTML content) separated by a ' ^ ' character. and then databound the column to the Dropdownlist value property.

So on selected index chang

How to pass argument to javascript function



in aspx page i have taken a simple html anchor tag like this:

<a id="l1" href="javascript:OnLookup();">Click</a>

when "Click" is clicked, that OnLookup function is called. But if i want to pass argument in that function then how can i pass ?

This anchor tag is generated dynamically through another javascript function.There can be more than one anchor tags, and each having different arguments in OnLookup function call .

How can pass arguments dynamically ?

Question regarding "Changes" argument of EditingScopeCompleted event


I'm building a custom Flowchart control with it's own designer, and have a question about how to properly tap into the "Changes" collection of the EditingScopeCompleted event handler.  I'm able to loop through the changes, but when I get to the "PropertyChange" type, I'm not sure how to utilize that ... I'd like to cast the Change from the event to a "PropertyChange" object, however it seems to be a protected object and not exposed for my use.  Any ideas how I work around this?

This is how I'm setting up the event handler to handle the editing scope changes:

      ModelTreeManager modelTreeManager = this.Context.Services.GetService<ModelTreeManager>();
      modelTreeManager.EditingScopeCompleted += new EventHandler<EditingScopeEventArgs>(this.ModelTreeManager_EditingScopeCompleted);

Then I want to do something like this:

if (change.GetType().ToString() == "System.Activities.Presentation.Model.PropertyChange")
    PropertyChange change3 = change as Prope
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