MVC :: Bind Exclude Parameter Not Working?

Mar 14, 2010

Isn't the Bind attribute, preferable the Exclude parameter, define any properties that will be excluded from any form update? If so, why does the ModelState is not valid when I do this?

[code]...

View 1 Replies


Similar Messages:

SQL Reporting :: MDX Query Parameter From SSRS / Setup @from And @to As Parameter But Not Working?

Aug 21, 2010

I've a MDX Query that has where clause as shown below.I'm designing report using SSRS 2008. How can i pass date as parameter? I tried to setup @from and @to as parameter but not working?

WHERE ( {[Date Central].[Calendar Date].[2010-04-01 00:00:00]:[Date Central].[Calendar Date].[2010-08-30 00:00:00]} )

need it to work as
WHERE ( {[Date Central].[Calendar Date].[@From]:[Date Central].[Calendar Date].[@To]} )

View 1 Replies

Databases :: Bind Multiple Parameter By Name?

Dec 15, 2010

In following code I am binding two parameter by name. Program compile successfully but output isn't coming.

cmd = new OracleCommand("select * from books where book_id=:bid and title=:rat", conn);
OracleParameter op = new OracleParameter();

View 2 Replies

Read Parameter String To ArrayList And Bind To GridView?

Jul 15, 2010

I have data in ParamList (from SQL reporting services database)which I want to display in a GridView. as ParameterName and VAlue. I am able to retrieve the parameters but can't figure out how to read them into ArrayList (or whatever method you coud suggest) and then bind to grid. Final grid should be like this-

ParameterName ParameterValue
Year 1011
Number1 0011
Number2 0101
Number3 0201

Here is the code I'm trying to figure out-

Dim intCount As Integer
Dim strparam As String
Dim strparam1 As String
Dim varResult As Object
Dim ParamList as string
ParamList = "Year=1011&Number1=0011&Number2=0101&Number3=0201"
varResult = Split(ParamList, "&")
Dim arrList As New ArrayList()
'loop through array and retrieve parms
For intCount = 0 To UBound(varResult)
varParam = Split(varResult(intCount), "=")
strparam1 = UCase(varParam(0))
strparam = varParam(1)
arrList = ???
Next
'and then display tsi data into a grid.
GridViewParams.DataSource = arrList

View 1 Replies

Data Controls :: Bind Multiple Database Fields As QueryString Parameter For HTML Anchor Hyperlink Inside GridView?

Sep 6, 2013

I have an anchor tag in gridview

<a href ='<%#"Edit_TidalData.aspx?Id="+DataBinder.Eval(Container.DataItem,"id") %>,'

where id is the datakeyname of the grid now i had a requirement to add another datakename as UserId. and i need to have DataBinder.Eval for UserId also.

How am going to use two values in this anchor tag using DataBinder.Eval?

View 1 Replies

MVC URL Parameter To Friendly Site Is Not Working?

Jun 22, 2010

have a search on my site, in which search type and search word are in URL like this: /search/t-someword.htmly route for search:

routes.MapRoute("Search", "searchj/{type}-{word}.html", new { controller = "Search", action = "Index"}, new { type = @"[t,s,p]"});

Everything works fine but when I change string to do not show spaces that word like "some words" looks like "some-words" it doesn't work. With spaces it works

View 4 Replies

Select Parameter Not Working On SqlDataSource.

Jul 1, 2010

I am using the stored procedure below for the select command of a SqlDataSource, and I'm trying to pass a query string parameter, but I get this error:

Procedure or function 'ActivationCampaignGetById' expects parameter '@campaignId', which was not supplied.

The parameter is present in the query string:

http://localhost:62681/Activations/ActivationCampaignDetails.aspx?id=98

Here is my DataSource code:

<asp:SqlDataSource ID="campaignDataSource" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ProVantageMediaManagement %>"
SelectCommand="ActivationCampaignGetById" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="98" Name="campaignId"
QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

And my stored procedure declaration:

ALTER procedure [dbo].[ActivationCampaignGetById]
@campaignId int
as
select

View 8 Replies

Select Parameter Not Working On SqlDataSource?

Apr 18, 2010

I am using the stored procedure below for the select command of a SqlDataSource, and I'm trying to pass a query string parameter, but I get this error:

Procedure or function 'ActivationCampaignGetById' expects parameter '@campaignId', which was not supplied.

The parameter is present in the query string:

http://localhost:62681/Activations/ActivationCampaignDetails.aspx?id=98

Here is my DataSource code:

<asp:SqlDataSource ID="campaignDataSource" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:ProVantageMediaManagement %>"
SelectCommand="ActivationCampaignGetById" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="98" Name="campaignId"
QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>

And my stored procedure declaration:

ALTER procedure [dbo].[ActivationCampaignGetById]
@campaignId int
as
select

View 1 Replies

Page Refresh And Bind Not Working?

Jan 3, 2010

I've got a .aspx and in it an .ascx. In the .ascx I have a server control.

The .aspx has a list of items in a cart The .ascx has a list of some cross-sell items (fed from a custom server control) that the customer can add to the cart if desired both the list of items in cart and list of cross sell items are driven by a repeater and bound on page load. So the .aspx calls a method that rebinds the cart items on page load. And the .ascx calls a method in its page load that rebinds the cross sell items in that custom control (.cs) that is in my .ascx.

The problem I have is, when the user clicks a "add to cart" button in the repeater inside my custom control, the page refreshes and what should happen is the cart items in the .aspx AND the list of cross sells should refrsh showing that the cross sell item was moved to the cart. But even though when I debug and I see the list being rebound with the corret # of items after the move, the page still shows the old state. I have to refresh the page manually again to get it to work.

I guess I need to check for Page.IsPostback? but even if I don't check that..at the least both lists should be refreshing regardless cause I have it in my page load. So even if it's a postback, and I'm not checking for that the lists should show the new state because I'm not even checking for postback anyway. So checking for postaback I don't think is the issue here cause i want the lists to rebind and re-update on any page load....initial or if it's a postback...it doesn't matter. Reload every time. But it doesn't seem to be doing this even though I clearly see the revbind of the lists having the right count (one less on the cross sell and one additional to the cart as it was added after the user clicked the button).

Here's the sequence of events:

User is on their cart page User sees a list of cart items that they have added to their cart already (this list is bound in the Cart.aspx and rebound on every page load)User sees a list of possible cross sell items they can add to their cart somewhere on the page. This list is a custom control found in my .ascx and that .ascx is obviously in my .aspx.

The custom control is just a repeater that lists out the cross sell itemsUser clicks one of the "Add to cart" buttons on one of the cross sells Page refreshes. In the page load of the .aspx AND the .ascx, I am going out to the DB and rebinding both those lists based on the new state...that is, the new lists after the item was added to the cart which means that now the cart items should have one more added to the list and it does...I clearly see that the new list has one more.

The page comes back after the refresh but I don't see the lists reflecting the new state...I don't see the new item in the cart items list and the added cross sell removed from the cross sell list even though again both lists when I debug are showing correct set of records reflecting the new state.

View 2 Replies

Web Forms :: Data Bind Is Not Working?

Jun 25, 2010

protected void ddOne_SelectedIndexChanged(object sender, EventArgs e) { PopulateType(); } private void PopulateType() { DataSet dstype = new DataSet(); //Assign DataSet by stored procedure that is working correctly and //DataSet has values that I want to ddType.DataSource = dstype; ddType.DataTextField = "Name"; ddType.DataValueField = "ID"; //I have watching values in visual studio.net and its working perfect //using QuickWatch and breakpoints ddType.DataBind(); }I have to give data source and bind a dropdownList with the event of another dropdownlist ....At code it is working good but At webpage, It is not showing the DropDownList.

View 3 Replies

ASMX :: Optional Parameter Is Not Working At WCF Service

Jul 27, 2010

I was expecting a parameter will become a empty string value if the parameter is missing, but it turn out to be null. have I done it wrong for the optional parameter?

[Code]....

View 3 Replies

MVC :: Dropdown Parameter In View For Reports Are Not Working?

Apr 13, 2010

I have a report where I need to select parameter values from dropdowns. Reports works fine when I run it on reportserver manager or when I do RUN.

The problem is when I try opening it in the MVC views to select parameters from a dropdown, its subsequent dropdown is not able to show its values

for example:

I am able to select first DD Country as it does not have any thing to select earlier.

The State DD is not rendering its relavent states from selected country. (it works in report manager and when I run it without debugging)

Question: how do code to make the dropdowns working.

View 1 Replies

DataSource Controls :: QueryString Parameter Not Working?

Jun 29, 2010

this has to be a simple thing but I am missing it

here's what i have

the null condition and query works

the not null condition does not

I have tried:

ImageID=@id error myust declare @id
ImageID=id invalid column id
ImageID=?id incorrect syntax at ?
all errors occur at SqlDataReader Dr = Cmd.ExecuteReader();
int id = Convert.ToInt32(Request.QueryString["id"]);
string SQLquery ="";
if (id == null)
{
SQLquery = "Select Top 1 ImageData,ImageType from WebBGImages ORDER BY NEWID()";
}
else
{
SQLquery = "Select ImageData,ImageType from WebBGImages where ImageID=@id";
}
SqlCommand Cmd = new SqlCommand(SQLquery, connection);
SqlDataReader Dr = Cmd.ExecuteReader();

View 1 Replies

DataSource Controls :: Output Parameter Not Working To Sqldatasource?

Aug 10, 2010

I am trying to get the uniqueidentifier value from a insert SP and retreive that using a sqldatasource and pass that value to store files in the relevent folder.

the SQL stored procedure

ALTER PROCEDURE [dbo].[sp_InsertIPRT]
@Site nchar(10),
@Description nvarchar(MAX),
@Application nvarchar(MAX),
@Coordinator nchar(50),
@ProjectNumber nchar(50),
@Manager nchar(50),
@DateRequested date,
@DateRequired date,
@Issues nvarchar(MAX),........

View 2 Replies

SQL Server :: Database Deletion Not Working When Parameter Involved?

Sep 2, 2010

I have a system in which users can enter records into a database via ajax. Each user may hold many values in the database, with different pageId and itemId values. Each user is identified by a GUID set to a cookie. The system needs to prevent the user from entering two pieces of data with the same pageId and itemId, so I've created a script to do two database updates:

Firstly, all records are deleted from the database where the memberGUID, pageId and itemId fields match (i.e. they've already added this item).

Secondly, the record is then recreated.

It all works brilliantly, except when the GUID value is passed into the delete statement, then I just get a caught exception.

So this works:

[Code]....

But this doesn't:

[Code]....

The weird thing is that because the GUID value is being saved in the second database call, it is definitely there and is definitely the right data type etc. Even if I hard-code it into the delete procedure it still causes the whole thing to fail.

why it's failing when I add the GUID parameter in the deletion process?

View 4 Replies

Web Forms :: Bind Multiple Query String Parameters From Database When Working With Eval

Aug 26, 2012

I have the following Repeater, I need to bind multiple querystring parameter inĀ  HREF

<li class="current">
<a href="house.aspx?H_name=all"></a>
<ul>
<asp:Repeater ID="rptMenu" runat="server">
<ItemTemplate>

[code]...

View 1 Replies

MVC :: Exclude Field From Validation?

Jun 4, 2010

I have data annotation validators:

[Code]....

On EDITION form I have only fields: 'title' and 'message' (without field 'link'), but for 'link' is still triggered validation. How can I exclude 'link' from validation in action. I have tried:

[Code]....

But this doesn't work. I still see: "The link field is required.". What is the solution ?

View 8 Replies

Exclude <br> Tag From Regex Not To Remove From Text?

Jan 26, 2011

I have code like this

string pattern = "<(.|
)+?>";
System.Text.RegularExpressions.Regex regEx = new System.Text.RegularExpressions.Reg(pattern);
string result = "";
result = regEx.Replace(htmlText, "");

In this "htmlText" will have some html code which also contains break tags. Right now its replacing all the html tags, but I want to leave break tag and replace the rest.

View 2 Replies

MVC :: URL Routing In Mvc To Exclude Controller/index Name From URL

Oct 21, 2010

I have this url working in my code:

[Code]....

I want to change my url to NOT to include the home/index [Code]....

ie, it should work like

[Code]....

My current Global.asax entry is like:

[Code]....

[Code]....

[Code]....

[Code]....

View 1 Replies

C# - Exclude An Object During Serialization In XmlSerialize?

Mar 7, 2011

I'm attempting to serialize an object but I would like to exclude one of the objects inside it. I've tried [NonSerialized] and it is still attempting to serialize it when I call XmlSerialize on a Cart object.

[Serializable]
[XmlRoot("Cart")]
public class Cart : ICart
{
// Public Properties
[DefaultValue("")]
public string ID { set; get; }
[XmlIgnore()]
[NonSerialized]
public CartSerializer Serializer = new CartSerializer(this);
}

View 1 Replies

Regular Expression - How To Exclude Certain String

Sep 13, 2010

I have the following regular expression replacement:

[Code]....

how to exclude certain string

View 4 Replies

AJAX :: Exclude Control From UpdatePanel?

Mar 5, 2011

On my MasterPage I use UpdatePanel to update whole ContentPlaceHolder. Example of code you can find below. All content pages work fine with this MasterPage except one. This page is very complex. I noticed that when I disable UpdatePanel in my MasterPage this problematic page works fine. Question: is it possible to exclude something from UpdatePanel - in my example whole page but only this one?

<asp:UpdatePanel
ID="UpdatePanel2"
runat="server">
<ContentTemplate>
<asp:ContentPlaceHolder
id="MainContent"
runat="server">
</asp:ContentPlaceHolder>
</ContentTemplate>
</asp:UpdatePanel>

View 14 Replies

Regex To Exclude Double Spaces?

Apr 19, 2010

I am looking for a regular expression for c# asp.net 3.5 that will fail if there are ever any double spaces in a sentence or group of words.

the cat chased the dog = true the cat chased the dog = false (doubles spaces occur at random intervals)

View 4 Replies

Exclude Some Fields Of An Entity When Saving?

Feb 8, 2011

All my entities have the following properties:

public virtual DateTime CreatedDate {get; set;}
public virtual string CreatedBy { get; set; }
public virtual DateTime UpdatedDate { get; set; }
public virtual string UpdatedBy { get; set; }

I've implemented a EventListener (IPreUpdateEventListener, IPreInsertEventListener) so that I can fill these properties before inserting/updating my entity.I do not load my entity just before saving cause I've got all my fields in a view (id, version). The only thing I would like to avoid to put in hidden fields (of my view) are CreatedDate and CreateBy.Since I fill these fields only once, when the entity is created the first time, I was wondering if there's a way to exclude them when I update (only update) my entitiy?!

View 1 Replies

MVC :: Exclude Binding Of Value To VM In Create Mode?

Feb 20, 2010

I have a VM which contains a DTO inside it and DTO again contains properties.

it is like this :

[Code]....

Now i attach this VM to a View and expect the contactPersonVM as parameter. I am using same View for both Create and Edit. When in Create Mode i don't want SysId property to be attached as it is not required in create Mode.

This is the code for create action:

[Code]....

Though i have Excluded SysId from Binding but its still giving me ModelState error of "SysId is required". If i attach a Bind attribute directly to ContactPerson DTO then it works but then it applies for both Create and Edit. I want Bind attribute to be only for Create Action.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved