In WebDataGrid control am having UnboundCheckBoxField. I want to get the unboundValues for checked UnboundCheckBoxField in WebDataGrid.
In code behind am having two server control one is radio button and another one is normal button. And having the same code on both event. In case of normal button am able to get the unboundvalues for checked UnboundCheckBoxField from DataSourceObjectView object that it return (as i mentioned below).
Infragistics.Web.UI.Framework.Data.DataSourceObjectView obj = igConfirmedRecommendationSearchResult.GetDataView();
Hashtable table = obj.UnboundValues;
But in the case of radion button event am unable to get the same result for UnboundValues.
Design Page
<body>
<form id="form1" runat="server">
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</cc1:ToolkitScriptManager>
<div>
<asp:RadioButton ID="rbAllConfirmedRecommendation" runat="server" Text="All" GroupName="Recommendation"
AutoPostBack="True" OnCheckedChanged="rbAllConfirmedRecommendation_CheckedChanged"
Checked="True" /><br />
<asp:RadioButton ID="rbSelectedConfirmedRecommendation" runat="server" Text="Selected"
GroupName="Recommendation" AutoPostBack="True" OnCheckedChanged="rbSelectedConfirmedRecommendation_CheckedChanged" />
</div>
<asp:UpdatePanel ID="recommendationUpdatePanel" runat="server">
<ContentTemplate>
<ig:WebDataGrid ID="igConfirmedRecommendationSearchResult" runat="server" Width="100%"
Height="348px" AutoGenerateColumns="False" DataKeyFields="CustomRecommendationId"
EnableAjax="true" EnableDataViewState="false" OnPageIndexChanged="igConfirmedRecommendationSearchResult_PageIndexChanged">
<Columns>
<ig:UnboundCheckBoxField Key="chkAll" Header-Text="All" Width="50px" />
<ig:BoundDataField Key="CustomRecommendationId" DataFieldName="CustomRecommendationId"
Width="20px" />
<ig:BoundDataField Key="AccountName" DataFieldName="AccountName" Width="270px" />
<ig:BoundDataField Key="PondName" DataFieldName="PondName" Width="235px" />
<ig:BoundDataField Key="RecommendationDate" DataFieldName="RecommendationDate" Width="75px" />
<ig:BoundDataField Key="ActivityName" DataFieldName="ActivityName" Width="100px" />
<ig:BoundDataField Key="Quantity" DataFieldName="Quantity" Width="40px" />
<ig:BoundDataField Key="Unit" DataFieldName="Unit" />
<ig:BoundDataField Key="UnitPrice" DataFieldName="UnitPrice" Width="65px" />
<ig:BoundDataField Key="WhenRecommended" DataFieldName="WhenRecommended" Width="65px" />
<ig:BoundDataField Key="Year" DataFieldName="Year" Width="50px" />
<ig:BoundDataField Key="Status" DataFieldName="Status" Width="60px" />
</Columns>
<Behaviors>
<ig:Paging PagerAppearance="Bottom" PageSize="100">
</ig:Paging>
<ig:Sorting>
</ig:Sorting>
<ig:ColumnResizing>
</ig:ColumnResizing>
<ig:ColumnMoving>
</ig:ColumnMoving>
</Behaviors>
<ig:EditingCore>
<ig:CellEditing>
<ColumnSettings>
<ig:EditingColumnSetting ColumnKey="chkAll" ReadOnly="false" />
</ColumnSettings>
</ig:CellEditing>
</ig:EditingCore>
</ig:WebDataGrid>
</ContentTemplate>
</asp:UpdatePanel>
<div style="width: 60%">
<asp:Label ID="lblTotalRecords" runat="server" Font-Names="verdana" Font-Size="12px"></asp:Label>
<div style="width: 30%">
<asp:Button ID="btnCheckedRecommendations" runat="server" Text="Checked Recommendation"
OnClick="btnCheckedRecommendations_Click" />
<asp:Button ID="btnUncheckedRecommendation" runat="server" Text="Unchecked Recommendation"
OnClick="btnUncheckedRecommendation_Click" />
<asp:Label ID="lblCheckedOrUnchechedRecommendationcount" runat="server" Font-Names="verdana"
Font-Size="12px"></asp:Label>
</form>
</body>
Code Behind Page
public partial class webdatagrid : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
if (Request.QueryString["JobId"] != null)
Guid customGUID = Guid.Parse(Request.QueryString["JobId"].ToString());
Session["JOBSCHEDULE"] = new customJobSchedule(customGUID);
JobScheduleDomainEntity scheduledJob = ((customJobSchedule)Session["JOBSCHEDULE"]).JobSchedule;
}
else
Session["JOBSCHEDULE"] = new customJobSchedule();
customJobSchedule jobschedule = (customJobSchedule)Session["JOBSCHEDULE"];
igConfirmedRecommendationSearchResult.ClearDataSource();
igConfirmedRecommendationSearchResult.DataSource = jobschedule.recommendationManager.getRecommendationTobeDisplayed();
igConfirmedRecommendationSearchResult.DataBind();
//LoadData();
protected void btnCheckedRecommendations_Click(object sender, EventArgs e)
LoadData();
//int count = 0;
//foreach (Infragistics.Web.UI.GridControls.GridRecord item in igConfirmedRecommendationSearchResult.Rows)
//{
// if (Convert.ToBoolean(item.Items[0].Value))
// {
// count++;
// }
//}
//lblCheckedOrUnchechedRecommendationcount.Text = count.ToString();
private void LoadData()
RecommendationSearchCriteria searchCriteria = new RecommendationSearchCriteria();
searchCriteria.OfficeId = 3;
jobschedule.recommendationManager.searchRecommendation(searchCriteria);
List<RecommendationDomainEntity> recommdlist = jobschedule.recommendationManager.getRecommendationTobeDisplayed();
igConfirmedRecommendationSearchResult.DataSource = recommdlist;
lblTotalRecords.Text = "Total Records : " + "<b style='Color:#35496A'>" + recommdlist.Count().ToString() + "</b>";
protected void btnUncheckedRecommendation_Click(object sender, EventArgs e)
string items = string.Empty;
foreach (DictionaryEntry item in obj.UnboundValues)
Dictionary<string, object> status = (Dictionary<string, object>)item.Value;
if (Convert.ToBoolean(status.ElementAt(0).Value))
string temp = item.Key.ToString().Replace("~$~", "");
items += temp + ",";
// if (!Convert.ToBoolean(item.Items[0].Value))
protected void igConfirmedRecommendationSearchResult_PageIndexChanged(object sender, Infragistics.Web.UI.GridControls.PagingEventArgs e)
protected void rbSelectedConfirmedRecommendation_CheckedChanged(object sender, EventArgs e)
//List<int> selectedRecommendations = getSelectedRecommendation();
//customJobSchedule jobschedule = (customJobSchedule)Session["JOBSCHEDULE"];
//jobschedule.recommendationManager.selectRecommendation(selectedRecommendations);
//List<RecommendationDomainEntity> recommds = jobschedule.recommendationManager.getSelectedRecommendation();
//igConfirmedRecommendationSearchResult.ClearDataSource();
//igConfirmedRecommendationSearchResult.DataSource = recommds;
//igConfirmedRecommendationSearchResult.DataBind();
protected void rbAllConfirmedRecommendation_CheckedChanged(object sender, EventArgs e)
jobschedule.recommendationManager.selectRecommendation(getSelectedRecommendation());
List<RecommendationDomainEntity> recommds = jobschedule.recommendationManager.getRecommendationTobeDisplayed();
igConfirmedRecommendationSearchResult.DataSource = recommds;
/// <summary>
/// Fillter selected recommendation on All radio button Selection Changed Event
/// </summary>
/// <returns>RecommendationDomainEntity</returns>
private List<int> getSelectedRecommendation()
List<int> tempColl = new List<int>();
string id = item.Key.ToString().Replace("~$~", "");
tempColl.Add(int.Parse(id));
return tempColl;
Hi kk007,
I would suggest you to use the following workaround to get the checked rows and their count:
protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
List<GridRecord> checkedRows = new List<GridRecord>();
foreach (GridRecord row in WebDataGrid1.Rows)
if ((bool)row.Items[0].Value)
checkedRows.Add(row);
Label1.Text = checkedRows.Count.ToString();
Please let me know if this helps.
Hi Nikolay,
Thanks for response. In my WebDataGrid control am having paging. So your solution will work only for current page size.
For example: In first page i have checked 2 records, go to second page of WebDataGrid i have checked one record. and come back to the first page of WebDataGrid and clicked on radio button. it shows only 2 record instead of 3 records from current context of WebDataGrid.
please response me.