I have a page with an ASP:Formview that contains a few Infragistics WebDropDown controls and an ASP:Gridview at the bottom. The Formview and Gridview are intended to be used like a Master/Detail page. When the page first loads, all of the controls including the Infragistics WebDropDowns display properly (have values). When I select another row in the Gridview, the Gridview's "SelectedIndexChanged" method is called. I'm using this method to rebind the Formview (pass the SelectParameter value) to show the attributes of the selected record. Visually, my selected row is highlighted in the gridview and all of the Formview controls are updated with the EXCEPTION of the Infragistics WebDropDown controls. Those display as BLANK. I am able to trace through the methods that are called:Formview_OnDataBoundWebDropDown_OnDataBoundWebDropDown_OnPreRenderand other Javascript that loads the WebDropDownControls to make sure each selected value is unique between the WDD controlsWhat might cause the WDD controls to display as BLANK (empty) after the row is selected (and page reloads)?Please advise,Chris
Hi Chris,
Could you provide me with a small isolated sample, reproducing this behavior, in order to be able to investigate it. As I am so far unable to replicate the issue.
Nikolay,
Thank you for your reply. It has been extremely challenging for me to find a resolution to this problem, which has highest priority in order to meet the development deadline. I would like to provide a simplified example (code sample)and explanation of what I need the page to display with the Infragistics WebDropDown controls. The "ddlSCP1" and "ddlSNOM1" are cascading drop downs. I believe that I have most (if not all) of the coding in place, but I think there may be an event that is not firing, or firing more than once causing the "ddlSNOM1" control to not display the appropriate items. For simplicity, I'm only including two webdropdown controls in this example. My page has a formview, Infragistic webdropdown controls, gridview, and two UpdatePanels.Description of problem: When the page is first loaded (!IsPostback), the values in "ddlSCP1" are correct, but the "ddlSNOM1" drop down list displays blank! From my debugging, it looks like the OnDataBinding and OnDataBound methods for the WDD controls are firing multiple times. I'm not sure why, and not sure that they should be. After the user selects another value in the "ddlSCP1" WDD, the new Nature of Matter grouping should display in the "ddlSNOM1" WDD. It looks like the data is correct, but I'm not binding correctly to render it on the page??? Please let me know what the correct approach is to accomplish this (add more code, delete some of this code, call different method).The markup in my page looks like this:<%@ Page Language="C#" MasterPageFile="~/JDmaster.master" AutoEventWireup="true" CodeFile="PDMMaintenance.aspx.cs" Inherits="PDMMaintenance" EnableEventValidation="false" %>
<
asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"> <ContentTemplate> <asp:Panel ID="Panel1" runat="server"> <asp:FormView ID="FormView1" runat="server" DataKeyNames="folder_id,matter_nbr,dept_cd" Width="95%" Visible="true" DefaultMode="Edit" DataSourceID="FormView1DataSource" OnItemUpdated="FormView1_ItemUpdated" OnPreRender="FormView1_OnPreRender" OnDataBound="FormView1_OnDataBound" OnUnload="FormView1_OnUnload" > <EditItemTemplate> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td style="font-weight: bold; width: 35%">Secondary Practice</td> <td><div id="divSCP1" style="overflow: auto"> <ig:WebDropDown ID="ddlSCP1" runat="server" AutoPostBack="true" SelectedValue='<%# DataBinder.Eval(Container.DataItem,"sprac1")%>' OnItemsRequested="ddlSCP1_OnItemsRequested" OnPreRender="ddlSCP1_OnPreRender" OnDataBinding="ddlSCP1_OnDataBinding" OnDataBound="ddlSCP1_OnDataBound" Visible="true" EnablePaging="false" PageSize="10" EnableRenderingAnchors="false" ForeColor="Black" EnableClosingDropDownOnSelect="true" KeepFocusOnSelection="true" Width="350"> <DropDownItemBinding TextField="dept_desc" ValueField="dept_code" /> <ClientEvents SelectionChanged="ddlSCP1SelectionChanged" /> </ig:WebDropDown> </div> </td> <td style="vertical-align: middle; font-weight: bold; width: 25%; text-align: right; font-size: 0.9em">SCNOM 1: </td> <td><div id="divSNOM1" style="overflow: auto"> <ig:WebDropDown ID="ddlSNOM1" runat="server" AutoPostBack="true" SelectedValue='<%# DataBinder.Eval(Container.DataItem,"snom1")%>' Width="350" Visible="true" ForeColor="Black" OnPreRender="ddlSNOM1_OnPreRender" OnDataBound="ddlSNOM1_OnDataBound" OnDataBinding="ddlSNOM1_OnDataBinding" OnItemsRequested="ddlSNOM1_OnItemsRequested" EnablePaging="false" PageSize="10" EnableRenderingAnchors="false"> <DropDownItemBinding TextField="label" ValueField="nom_cd" /> </ig:WebDropDown> </div> </td> </table> </EditItemTemplate> </asp:FormView> </asp:Panel> </ContentTemplate></asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" Visible="true"> <Triggers><asp:AsyncPostBackTrigger ControlID="btnCheckAll" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="btnunCheckall" EventName="Click" /> </Triggers> <ContentTemplate> <asp:Panel ID="Panel3" runat="server"> <table> <tr> <td> <asp:Panel ID="Panel2" runat="server" Width="95%" Height="200px" ScrollBars="Vertical" Visible="true"> <asp:GridView ID="gvPracticeDetail" runat="server" EnableViewState="true" Visible="true" AutoGenerateColumns="False" ClientIDMode="Static" DataKeyNames="folder_id,client_nbr, opendt, confidential_flg, matter_desc, rpt_atty, matter_nbr,nom, lsc, sprac1,sprac2,sprac3,sprac4,sprac5,snom1,snom2,snom3,snom4,snom5" OnSelectedIndexChanged="gvPracticeDetail_SelectedIndexChanged" OnDataBound="gvPracticeDetail_DataBound" OnRowDataBound="gvPracticeDetail_OnRowDataBound" AllowSorting="True" OnSorting="gvPracticeDetail_OnSorting" OnSorted="gvPracticeDetail_OnSorted" OnPageIndexChanged="gvPracticeDetail_OnPageIndexChanged" OnPageIndexChanging="gvPracticeDetail_OnPageIndexChanging" AllowPaging="true" PageSize="20" PagerSettings-Mode="Numeric" PagerStyle-CssClass="GridPager" PagerSettings-Position="TopAndBottom" PagerSettings-PageButtonCount="10" > <EditRowStyle BackColor="White" /> <RowStyle BackColor="White" VerticalAlign="Top" HorizontalAlign="Left" /> <Columns> <asp:CommandField ShowSelectButton="False" /> <asp:TemplateField> <ItemTemplate> <asp:Button runat="server" Style="display:none" CommandName="Select" Text="Select" ID="btnSelect" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Selector" HeaderStyle-Width="50px" HeaderStyle-VerticalAlign="Middle" HeaderStyle-HorizontalAlign="Left"> <ItemTemplate> <asp:CheckBox ID="MatterSelector" runat="server" Checked='<%#Convert.ToBoolean(Eval("chkbox_value")) %>'/> </ItemTemplate> <ItemStyle Width="50px" HorizontalAlign="Left" /> <EditItemTemplate> <asp:CheckBox ID="MatterSelector" runat="server" Checked='<%# Bind("chkbox_value") %>'/> </EditItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> </asp:Panel> </ContentTemplate></asp:UpdatePanel><asp:SqlDataSource ID="FormView1DataSource" runat="server" ConnectionString="<%$ ConnectionStrings:PDMConnectionString %>" OnSelecting="FormView1DataSource_OnSelecting" SelectCommandType="StoredProcedure" OnDataBinding="FormView1DataSource_OnDataBinding" CancelSelectOnNullParameter="false" ></asp:SqlDataSource>My code behind looks like this (only showing few pertinent methods):
protected void Page_Load(object sender, EventArgs e){ if (!IsPostBack) { DataTable dt = new DataTable(); [If condition here to determine where the user came from - determine which page was the source page (did the user perform a search or open/edit a folder] FormView1DataSource.SelectParameters.Clear(); FormView1DataSource.SelectCommand = "sp_FMVWSearch_By_nonSecondaryOther"; FormView1DataSource.SelectParameters.Add("Primary_Practice", DbType.String, primPractice); FormView1DataSource.SelectParameters.Add("Primary_NOM", DbType.String, primNOM); FormView1DataSource.SelectParameters.Add("lsc", DbType.String, lsc); FormView1DataSource.SelectParameters.Add("matter", DbType.String, matter); FormView1DataSource.SelectParameters.Add("clientNbr", DbType.String, clientNbr);| FormView1DataSource.SelectParameters.Add("cslJP ", DbType.String, cslJP); FormView1DataSource.SelectParameters.Add("rptJP", DbType.String, rptJP);
//Populate data table for gridview dt = mBLL.spSearch_By_nonSecondaryOther(primPractice, primNOM, lsc, matter, clientNbr, cslJP, rptJP); dt.DefaultView.Sort = "matter_nbr ASC"; gvPracticeDetail.DataSource = dt; gvPracticeDetail.DataBind(); gvPracticeDetail.SelectedIndex = 0; } /* !IsPostBack */ else { }}protected void ddlSCP1_OnDataBinding(Object sender, EventArgs e){ string scp1val = ""; Infragistics.Web.UI.ListControls.WebDropDown ddlSCP1 = (Infragistics.Web.UI.ListControls.WebDropDown)sender; FormView formViewContainer = (FormView)ddlSCP1.NamingContainer; if ((DataRowView)formViewContainer.DataItem != null) {
DataRowView
rowView; rowView = (DataRowView)formViewContainer.DataItem; string primPractice = rowView["dept_cd"].ToString(); string sp2val = rowView["sprac2"].ToString(); string sp3val = rowView["sprac3"].ToString(); string sp4val = rowView["sprac4"].ToString(); string sp5val = rowView["sprac5"].ToString(); DataTable dt = mBLL.spBuild_SCP1_DDList(primPractice, sp2val, sp3val, sp4val, sp5val); ddlSCP1.DataSource = dt;
if (scp1val != primPractice) ddlSCP1.SelectedValue = scp1val; }}
protected
void ddlSCP1_OnDataBound(object sender, EventArgs e){ Infragistics.Web.UI.ListControls.WebDropDown ddlSCP1 = (Infragistics.Web.UI.ListControls.WebDropDown)sender; string convertedText = ""; for (int i = 0; i < ddlSCP1.Items.Count; i++) { convertedText = Convert_MixedCase(ddlSCP1.Items[i].Text); ddlSCP1.Items[i].Text = convertedText; }}protected void ddlSNOM1_OnDataBound(object sender, EventArgs e){ Infragistics.Web.UI.ListControls.WebDropDown ddlSNOM1 = (Infragistics.Web.UI.ListControls.WebDropDown)sender; Infragistics.Web.UI.ListControls.WebDropDown ddlSPRAC1 = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("ddlSCP1"); Infragistics.Web.UI.ListControls.WebDropDown ddlPPractice = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("lstPractice"); if ((ddlSPRAC1.SelectedValue == String.Empty) || (ddlSPRAC1.SelectedValue == ddlPPractice.SelectedValue) || (ddlSPRAC1.SelectedValue == "%")) { ddlSNOM1.Items.Clear(); DataTable dt2 = mBLL.spBuild_MASTER_SNOM_DDList(); ddlSNOM1.DataSource = dt2; ddlSNOM1.SelectedValue = "%"; } else { string selectedSNOM1 = ddlSNOM1.SelectedValue; //call procedure to build snom list to display grouping ddlSNOM1.Items.Clear(); DataTable dt2 = mBLL.spBuild_SNOM_DDList(ddlSPRAC1.SelectedValue); ddlSNOM1.DataSource = dt2; if (!String.IsNullOrEmpty(selectedSNOM1)) ddlSNOM1.SelectedValue = selectedSNOM1; } //convert text in each item to mixed case string convertedText = ""; for (int i = 0; i < ddlSNOM1.Items.Count; i++) { convertedText = Convert_MixedCase(ddlSNOM1.Items[i].Text); ddlSNOM1.Items[i].Text = convertedText; }
}protected void ddlSNOM1_OnDataBinding(Object sender, EventArgs e){ Infragistics.Web.UI.ListControls.WebDropDown ddlSNOM1 = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("ddlSNOM1"); FormView formViewContainer = (FormView)ddlSNOM1.NamingContainer; //Add check if ddl SNOM1 already loaded by client-event, skip over this IF condition if ((DataRowView)formViewContainer.DataItem != null) {
DataRowView rowView = (DataRowView)formViewContainer.DataItem; string sprac1 = rowView["sprac1"].ToString(); string pprac = rowView["dept_cd"].ToString(); if ((sprac1 == String.Empty) || (sprac1 == pprac) || (sprac1 == "%")) { ddlSNOM1.Items.Clear(); ddlSNOM1.ClearSelection(); DataTable dt2 = mBLL.spBuild_MASTER_SNOM_DDList(); ddlSNOM1.DataSource = dt2; ddlSNOM1.SelectedValue = "%"; } else { string selectedSNOM1 = ddlSNOM1.SelectedValue; //call procedure to build snom list to display grouping ddlSNOM1.Items.Clear(); ddlSNOM1.ClearSelection(); DataTable dt2 = mBLL.spBuild_SNOM_DDList(sprac1); ddlSNOM1.DataSource = dt2; if (!String.IsNullOrEmpty(selectedSNOM1)) ddlSNOM1.SelectedValue = selectedSNOM1; } }
}
//Occurs AFTER the formview server control binds to a data source.
protected void FormView1_OnDataBound(object sender, EventArgs e){ DataRowView dataRow = ((DataRowView)FormView1.DataItem); if (dataRow != null) { Infragistics.Web.UI.ListControls.WebDropDown ddlSCP1 = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("ddlSCP1"); if (ddlSCP1 != null) { ddlSCP1.Attributes["onchange"] = string.Format("BLOCKED SCRIPTUpdate2ndaryPractDDLs('{0}','{1}');", 1, 0); } string sprac1 = ""; if (gvPracticeDetail.SelectedDataKey != null) sprac1 = gvPracticeDetail.SelectedDataKey["sprac1"].ToString(); if (!String.IsNullOrEmpty(sprac1)) ddlSCP1.SelectedValue = sprac1; Infragistics.Web.UI.ListControls.WebDropDown ddlSCNOM1 = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("ddlSNOM1"); if (ddlSCNOM1 != null) { string snom1 = ""; if (gvPracticeDetail.SelectedDataKey != null) { snom1 = gvPracticeDetail.SelectedDataKey["snom1"].ToString(); if (!String.IsNullOrEmpty(snom1)) ddlSCNOM1.SelectedValue = snom1; } } else { ddlSCNOM1.DataSourceID = "glbNOMDataSource"; ddlSCNOM1.TextField = "label"; ddlSCNOM1.ValueField = "nom_cd"; ddlSCNOM1.DataBind(); }
} /* if (dataRow != null) */ }//this server side method is called when "ddlSNOM1.loadItems(newSelection)"//is run in the Javascript function ddlSCP1SelectionChanged (shown below)protected void ddlSNOM1_OnItemsRequested(object sender, Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs e){ string selectedSPRAC1 = ""; if (e.Value != null) selectedSPRAC1 = e.Value.ToString(); if (selectedSPRAC1 != "%") { Infragistics.Web.UI.ListControls.WebDropDown ddlSCNOM1 = (Infragistics.Web.UI.ListControls.WebDropDown)FormView1.FindControl("ddlSNOM1"); ddlSCNOM1.Items.Clear(); DataTable dt2 = mBLL.spBuild_SNOM_DDList(selectedSPRAC1); ddlSCNOM1.DataSource = dt2; ddlSCNOM1.DataBind(); }}The Javascript function(s) look like this://After ddlSCP1 is changed, create practice/nom grouping for ddlSNOM1function ddlSCP1SelectionChanged(sender, e) { var ddlSNOM1 = $find(scnom1DDL_id); var newSelection = sender.get_selectedItem().get_value(); ddlSNOM1.loadItems(newSelection);}Thank you for your help,Chris
Sorry for the late response. I could not run the code you provided because it is using some custom classes and external database so I'm so far unable to tell what is causing the behavior you have described. Please try to isolate the issue in a seperate example, containing only WebDropDowns and code which you think is relevant.
Thank you.
This specific problem that I described in my last reply has been resolved. Unfortunately, there is still another "broken" piece of the overall logic that controls what values are displayed in each of my five <ig:WebDropDown> controls. I have a case open (CAS-96229-TK6VKH) to work on this. Thank you for your help,Chris
Hello Chris,
Thank you for the reply.
If you have any other questions, please do not hesitate to ask.