Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
80
Unable to get the UnboundValues on click event of Radio Button
posted

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>

 

    <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>

 

                    <Behaviors>

 

                        <ig:EditingCore>

 

                            <Behaviors>

 

                                <ig:CellEditing>

 

                                    <ColumnSettings>

 

                                        <ig:EditingColumnSetting ColumnKey="chkAll" ReadOnly="false" />

 

                                    </ColumnSettings>

 

                                </ig:CellEditing>

 

                            </Behaviors>

 

                        </ig:EditingCore>

 

                    </Behaviors>

 

                </ig:WebDataGrid>

 

            </ContentTemplate>

 

        </asp:UpdatePanel>

 

    </div>

 

    <div>

 

        <div style="width: 60%">

 

            <asp:Label ID="lblTotalRecords" runat="server" Font-Names="verdana" Font-Size="12px"></asp:Label>

 

        </div>

 

        <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" />

 

        </div>

 

    </div>

 

    <div style="width: 60%">

 

        <asp:Label ID="lblCheckedOrUnchechedRecommendationcount" runat="server" Font-Names="verdana"

 

            Font-Size="12px"></asp:Label>

 

    </div>

 

    </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()

        {

            Session["JOBSCHEDULE"] = new customJobSchedule();

            customJobSchedule jobschedule = (customJobSchedule)Session["JOBSCHEDULE"];

            RecommendationSearchCriteria searchCriteria = new RecommendationSearchCriteria();

            searchCriteria.OfficeId = 3;

            jobschedule.recommendationManager.searchRecommendation(searchCriteria);

            List<RecommendationDomainEntity> recommdlist = jobschedule.recommendationManager.getRecommendationTobeDisplayed();

            igConfirmedRecommendationSearchResult.ClearDataSource();

            igConfirmedRecommendationSearchResult.DataSource = recommdlist;

            igConfirmedRecommendationSearchResult.DataBind();

            lblTotalRecords.Text = "Total Records : " + "<b style='Color:#35496A'>" + recommdlist.Count().ToString() + "</b>";

        }

 

        protected void btnUncheckedRecommendation_Click(object sender, EventArgs e)

        {

            Infragistics.Web.UI.Framework.Data.DataSourceObjectView obj = igConfirmedRecommendationSearchResult.GetDataView();

            Hashtable table = obj.UnboundValues;

            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 + ",";

                }

            }

            //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();

        }

 

        protected void igConfirmedRecommendationSearchResult_PageIndexChanged(object sender, Infragistics.Web.UI.GridControls.PagingEventArgs e)

        {

 

         }

        protected void rbSelectedConfirmedRecommendation_CheckedChanged(object sender, EventArgs e)

        {

            Infragistics.Web.UI.Framework.Data.DataSourceObjectView obj = igConfirmedRecommendationSearchResult.GetDataView();

            Hashtable table = obj.UnboundValues;

            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 + ",";

                }

            }

            //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)

        {

            customJobSchedule jobschedule = (customJobSchedule)Session["JOBSCHEDULE"];

            jobschedule.recommendationManager.selectRecommendation(getSelectedRecommendation());

            List<RecommendationDomainEntity> recommds = jobschedule.recommendationManager.getRecommendationTobeDisplayed();

            igConfirmedRecommendationSearchResult.ClearDataSource();

            igConfirmedRecommendationSearchResult.DataSource = recommds;

            igConfirmedRecommendationSearchResult.DataBind();

        }

        /// <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>();

            Infragistics.Web.UI.Framework.Data.DataSourceObjectView obj = igConfirmedRecommendationSearchResult.GetDataView();

            Hashtable table = obj.UnboundValues;

 

            foreach (DictionaryEntry item in obj.UnboundValues)

            {

                Dictionary<string, object> status = (Dictionary<string, object>)item.Value;

                if (Convert.ToBoolean(status.ElementAt(0).Value))

                {

                    string id = item.Key.ToString().Replace("~$~", "");

                    tempColl.Add(int.Parse(id));

                }

            }

            return tempColl;

        }

    }

Please give me response as soon as possible.

 

 

Parents Reply Children