.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

MVC Binding to dynamic checkbox group

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


I'm not sure of how the view binds to dynamic checkbox group...I'm having problems posting values back to controller. 


public class CheckboxInfo
    #region Private Fields

    private string _text;
    private string _value;
    private bool _ischecked;

    #region Public Properties

    public CheckboxInfo()
    public CheckboxInfo(string text, string value, bool ischecked) 
        _text = text;
        _value = value;
        _ischecked = ischecked;

    public string Text
        get { return _text; }
        set { _text = value; }
    public string Value
        get { return _value; }
        set { _value = value; }

    public bool IsChecked
        get { return _ischecked; }
        set { _ischecked = value; }



using System;
using System.Collections.Generic;
using MVCWebAppStage2.NorthwindServices;
using System.Web.Mvc;

public class CustomerViewData

    private List<CheckboxInfo> _countryCheckboxes = new List<CheckboxInfo>();
    private IEnumerable<Customer> _customerList = new List<Customer>();

    public List<CheckboxInfo> CountryCheckboxes
        get { return _countryCheck

View Complete Post

More Related Resource Links

Dynamic WPF: Create Flexible UIs With Flow Documents And Data Binding


Flow documents offer enormous flexibility in arranging text layout and pagination, but they don't support data binding, so you can't dynamically change content. Here we build a component to solve that problem.

Vincent Van Den Berghe

MSDN Magazine April 2009

Other group with VisualTotals and dynamic dimension

I All, I’m trying to create a query that dynamically display a dimension attribute on rows. I want display only first N member of that dimension attribute and aggregate the others in ‘Others’ member   (this query should be used in Reportig services and data displayed in both Crosstab and Pie Chart). So I’ve 2 parameters:   @TopN: Value: 5 @RowDimension:  Value: [Product].[Subcategory]   And the code look like this:   WITH SET [DynamicDimension] as strtoSet(@RowDimension + '.MEMBERS') MEMBER [Measures].[RowCaption] as strtoMember(@RowDimension).MEMBER_CAPTION   SET [TopItem] as TopCount(DynamicDimension,@TopN,[Measures].[Order Count]) SET [BottomItem] as {[DynamicDimension]} - {[TopItem]}   MEMBER [Product].[Subcategory].[Other ] as aggregate(BottomItem)   SELECT {[Measures].[Order Count]} ON COLUMNS , Non Empty {      [TopItem] ,[Product].[Subcategory].[Other]     } ON ROWS FROM [Adventure Works]   Unfortunately this solution doesn’t work when I change the value of parameter @RowDimension (ex with [Customer].[Customer Name]). This is because calculated member “ [Product].[Subcategory].[Other]” is related to Product dimension and is not possible parametrize the name of a member. Any suggestions?   The alternative solution that I&r

Dynamic Binding of a Public Property in a User Control

Hi, I am not sure how to pass a variable from an .aspx page to an .ascx page.  I have a Control that puts rotating banners on a page.  The control has several public properties.  However, only one of those properties changes on the page level.  All the other properties are the same for every page site-wide.  So, instead of setting all the properties on every page in my sites (many sites), I want to set it up so I only have to setup the sitewide properties once and only the page level properties on each page.   I want to create a control with a property of AdKeyword="somename" and pass it to another control that will grab that page-level property and add it to all the other site-wide properties.  I guess what I need could be called a Dynamic Control Property.   My .aspx page has:<%@ Register TagPrefix="uc1" TagName="Banner1" Src="banner1.ascx" %> <asp:Content ID="Leaderboard" runat="server" ContentPlaceHolderID="Leaderboard"> <uc1:Banner1 AdKeyword="L2Chamber" runat="server" OverrideHeight="90" /> </asp:Content> My banner1.ascx page has:<%@ Control Language="VB" ClassName="UserControl297" %> <%@ register tagprefix="uc1&

Creating Dynamic Group Fields for a Crystal Report?

I have a VB.Net application which generates quite a few Crystal Reports. One report in particular has a Group Section. What I am trying to do with my VB.Net app is pass a value (a sql server column name used in the report). This value is represented by radio buttons. For example, the user may check either "ZipCode" or "State" or "Category" or "Type" or "Vendor". Each of these options represent a column in the database table used in the report. I simply want to be able to write the "SelectionFormula" using one of these options but not sure how to go about it. Thanks, Blake

silverlight + WCF Service + Dynamic proxy(custom binding) + basic authentication on iis

hi all, I am having an issue with how to get windows identity in silverlight project. Below is my scenario: the silverlight application need to get data from server via WCF service, i used the way that built dynamic proxy at runtime and aslo used custombinding in this case. Now my application need to deploy on iis and chosen "basic authentication" as a authentication mode. Thus i have chosen authentication mode in WCF was " <security authenticationMode="UserNameOverTransport">". At the client side where kind of project is silverlight that i need have to dynamic proxy with custombinding. My question is: In basic authentication how can i get windows identity to set to chanelfactory.Credentials: _channelFactory = new ChannelFactory<TWebService>(this._binding, new EndpointAddress(_endpointAddress));            _channelFactory.Credentials.UserName = new UserNamePasswordClientCredential();            _channelFactory.Credentials.UserName.UserName = "username";            _channelFactory.Credentials.UserName.Password = "password"; actually, i do not want to use Windows a

Dynamic columns on row group page

Hi, I have a SSRS (2008 R2) report on an Olap data source. On rows I have Agents (as a row group), on columns I have Stores (as a column group) and a measure, let's say SeelOutValue. I want to see sales from agents to stores. I added a page break between each group instance on the Agent row group => one page for an Agent, but the column stores are not filtered by the Agent. I want to see on an Agent page only the stores with values. My question: can I filter the columns (Stores column group) for each Agent (row group)?  Example Dataset:             Store1 Store2 Store3 Store4 Store5  Agent1     1                   1                    1     Agent2     2         2 Agent 3  .... Now an each Agent page there are all 5 stores columns (on Agent1 page column Store2 and Store4 without data). It is possible to see on Agent1 page only Store1, Store3 and Store5 columns, on Agent2 page Store1 and Store2 columns ... ?   Thanks in advance for your help!

Dynamic ItemTemplate binding?



I defined an ItemTemplate for an object type.

    <DataTemplate x:Key="listViewItemTemplate" DataType="{x:Type model:ParameterWithValue}">
        <Grid DockPanel.Dock="Top" IsEnabled="{Binding Enabled, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}">
When one or more of my objects change their Enabled properties, the layout is not updated... why this?

Dynamic data binding in rdl reports


I was wondering if rdl reports displayed on ReportViewer could be dynamically data-binded.

If I want to generate a rdl report of a certain month by choosing the months of a year included in a dropdownlist, instead of generating 12 reports and uploading them to Report Server, is there a more dynamic way to display a rdl report on ReportViewer?(e.g. using parameters) I'm displaying the reports on the webpage, so I hope this is something I can do programmatically.

I done some research on this but still couldn't find a clue. Thanks in advance! 

update dynamic checkbox list


Hi there .. on page load I fill a repeater with checkboxes. I use a separate tablelist (subcatID & userID) to check if chkbox is checked or not.

On pageload and works fine (according boxes are checked):

For i = 0 To rptFavorites.Items.Count - 1
                Dim subcatID As Label = DirectCast(rptFavorites.Items(i).FindControl("lblSubcatID"), Label)
                Dim available As Label = DirectCast(rptFavorites.Items(i).FindControl("lblAvailable"), Label)
                Dim chksubcat As CheckBox = DirectCast(rptFavorites.Items(i).FindControl("chkSubcat"), CheckBox)

                Dim conn3 As New SqlConnection(ConfigurationManager.ConnectionStrings("VCConnString").ConnectionString)
                Dim cmd3 As New Data.SqlClient.SqlCommand("Select * From tbl_interest where userID=@userID and subcategory=@subcategory", conn3)
                cmd3.Parameters.AddWithValue("@userID", "28")
                cmd3.Parameters.AddWithValue("@subcategory", subcatID.Text)
                Dim myReader3 As Data.SqlClient.SqlDataReader
                myReader3 = cmd3.ExecuteReader()
                If myReader3.Read() Then
                    chksubcat.Checked = True
                    available.Text = "Y"

Binding to a checkbox


I have the following code:

 <label>Date Code Check:</label>
        <div class="editor-field ">
                <%= Html.CheckBoxFor(Function(m) m.PackingCheck.Date_Code_Check)%>
                <%= Html.ValidationMessageFor(Function(m) m.PackingCheck.Date_Code_Check)%>

And I am getting the following error: 

Templates can be used only with field access,
property access, single-dimension array index, or single-parameter custom indexer expressions.

I am just starting to learn MVC and I am liking it.  My editor-fields for textboxes work just fine.

Thanks for the information and help.



gridview checkbox group by problem



i am using this component http://www.agrinei.com/gridviewhelper/gridviewhelper_en.htm and it works great. The problem im facing is that i need to add a checkbox column(added dinamically) and group by that checkbox. I have added the checkbox using:

        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
            OnSorting="GridView2_Sorting" >
                <asp:BoundField DataField="Client" HeaderText="Client" SortExpression="Client" />
                <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
                <asp:BoundField DataField="BilledBy" HeaderText="BilledBy" SortExpression="BilledBy" />
                        <asp:CheckBox ID="Include" runat="server" Text='<%# Eval("Project") %>' />

And as specified in the link, i use this code to make the grouping:

Dynamic Column headers changes according group level


Hello all,

I have a report with few grouping levels. by default few of the group levels are visible, while for a detailed report either specific group need to be collapsed, or detailed report option to be chosen.

Since in the group summary line I have few statistics, I want the report column header/names to be changed dynamically. I have used expression in header so it will change dynamically when a user wish to see the detailed or summary report using:

=IIf(Parameters!P_Detailed_Report.Value="Y","Detailed column header ","Summary column Header")

But the above won't work off course when the user actively collapses a group.

Can I have the header text to change when a certain group is collapsed by user ? 




What is dynamic binding in C#



good evenning all,

can anybody tell me what is dynamic or late binding in C#(oops) with practical example.

Thanks to all.

Problems with Binding Icon in dynamic MenuItem


I'm don't understand when I use hardcoded
<MenuItem.Icon><Image Source="images\image.png"/></MenuItem.Icon>
all works fine, but when I use binding it doesn't work :( !!!

<XmlDataProvider x:Key="data">
Items xmlns=""

How to create a dynamic list of checkbox controls in Infopath


I am relatively new to sharepoint, and since I do not yet have a proper development environment in my current contract, I have had to attempt to produce solutions to various line of business problems using Nintex and Infopath alone.  They are working on getting one created for me but i still can't believe microsoft make you purchase a whole other sharepoint server licence unless you think developing directly on the live server is a good idea, but I digress, thats not the issue I need assistance with.

The current issue I am trying to find a solution for, or atleast the right way to approach, is the creation of a simple form where the user can check off a register of daily tasks completed and submit the form back to sharepoint from a tablet PC.  Each submission is to create a new entry in the DailyRegister list with a handful of other fields like who, where, when, etc.

That is the easy part that I was able to produce with relative ease, but where it gets tricky is they want the list of tasks to be dynamic. 

i.e. A separate sharepoint list that will just hold the list of currently relevant tasks to be included in the form for that day.  Effectively using a 3rd list as the relational reference table between the DailyRegister list and the AvailableTasks list.

I am planning to create the AvailableTasks list to look something like:

Dynamic binding in Mind Map


Hi Team,


I would like to pass parameter to database from SharePoint site in turn from the query result I need to generate mind manger dynamically and bind to SharePoint site.


Is the above case is possible?


Any idea for the above scenario if so kindly help me in doing so….


Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.
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