radcombobox is not showing popup when postback occurs.

2 posts, 0 answers
  1. Tirumalesh
    Tirumalesh avatar
    23 posts
    Member since:
    Aug 2011

    Posted 08 Oct 2011 Link to this post

    I'm using radGrid and a xmlhttppanel,with in the xmlhttppanel i have some grids(to display project details) and a raddatetimepicker,radcombobox.When i login,the main grid displays all projects and when i select a gridrow the particular project details will be displayed in grids undertabs and the due date , status are displayed in datetimepicker and combobox respectively.when  change the status(in combobox) of my project and click a update button, the btnUpdate_Click has to update the database.after updating when i click combobox it works fine,but if i select any control other than the combobox,the values in combobox not popup,i mean no dropdown displaying.

    Default.aspx:
     <telerik:RadGrid ID="RadGrid1" runat="server" >
       <ClientEvents OnRowSelected="rowSelected"></ClientEvents>
       <MasterTableView Width="100%" CommandItemDisplay="Top" ClientDataKeyNames="ProjectId"  DataKeyNames="ProjectId">
        </Mastertabkeview>
      </telerik:radgrid>

    <telerik:RadXmlHttpPanel ID="RadXmlHttpPanel1" EnableClientScriptEvaluation="true"
                                        runat="server" OnServiceRequest="XmlHttpPanel_ServiceRequest" RenderMode="Block"
                                        Width="750px">
      <table><tr><td>
            <telerik:RadComboBox ID="cmbStatus" runat="server">    </telerik:RadComboBox>  
        </td>
      <td><telerik:RadDateTimePicker runat="server" ID="dtDuedate" Culture="en-US" FocusedDate=""   MinDate="">                                                                                                                 <TimeView CellSpacing="-1" runat="server">
                                                                    </TimeView>
                                                                    <TimePopupButton HoverImageUrl="" ImageUrl="" Visible="False" />
                                                                    <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False"                                                                                                                ViewSelectorText="x" runat="server">
                                                                    </Calendar>
                                                                    <DateInput DateFormat="M/d/yyyy" DisplayDateFormat="M/d/yyyy" runat="server">
                                                                    </DateInput>
                                                                    <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                                                </telerik:RadDateTimePicker>
      </td><td><asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="btnUpdate_Click"  /> </td></tr>
    *******grids here**********
    </table>
    </telerik:xmlhttppanel>

    Default.aspx.cs:
    protected void Page_Load(object sender, EventArgs e)
        {
            ProTrakEntities objEntity = new ProTrakEntities();
            if (Page.IsPostBack)
            {
                if (Session["ProjectId"] != null)
                { 
                   Control cause = GetPostBackControl(Page);
                        if (cause != null)
                        {
                            if (cause.ClientID != "btnUpdate")
                            {
                                ProTrakEntities ProEntity = new ProTrakEntities();
                                var Status = (from type in ProEntity.ProjectStatus select type).ToList();
                                cmbStatus.DataSource = Status;
                                cmbStatus.DataValueField = "StatusId";
                                cmbStatus.DataTextField = "Status";
                                cmbStatus.DataBind();
                                cmbStatus.SelectedValue = Query.StatusId.ToString();
                            }
                        }
                    }
                 }
           if (!Page.IsPostBack)
            {
               if (Session["ProjectId"] != null)
                    {                 
                            ProTrakEntities ProEntity = new ProTrakEntities();
                            var Status = (from type in ProEntity.ProjectStatus select type).ToList();
                            cmbStatus.DataSource = Status;
                            cmbStatus.DataValueField = "StatusId";
                            cmbStatus.DataTextField = "Status";
                            cmbStatus.DataBind();
                            cmbStatus.SelectedValue = Query.StatusId.ToString(); 
                     }
               }
            }
         public static Control GetPostBackControl(Page page)
        {
            Control postbackControlInstance=null;
            string postbackControlName = page.Request.Params.Get("__EVENTTARGET");
            if (postbackControlName != null && postbackControlName != string.Empty)
            {
                postbackControlInstance = page.FindControl(postbackControlName);
            }
            else
            {
                for (int i = 0; i < page.Request.Form.Keys.Count; i++)
                {
                    postbackControlInstance = page.FindControl(page.Request.Form.Keys[i]);
                    if (postbackControlInstance is System.Web.UI.WebControls.Button)
                    {
                        return postbackControlInstance;
                    }
                }
            }
           return postbackControlInstance;
        }
       protected void XmlHttpPanel_ServiceRequest(object sender, RadXmlHttpPanelEventArgs e)
        {
            string val = e.Value;
            int projectId = Convert.ToInt32(val);
            projectid = projectId;
            Session["ProjectId"] = val;
          ***binding grids based on  projectid***
              var Status = (from type in objEntity.ProjectStatus select type).ToList();
             var Query = (from p in objEntity.Projects where p.ProjectId == projectId select p).First();
               cmbStatus.DataSource = Status;
               cmbStatus.DataValueField = "StatusId";
               cmbStatus.DataTextField = "Status";
               cmbStatus.DataBind();
               cmbStatus.SelectedValue = Query.StatusId.ToString();   
         }  
       protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (Session["ProjectId"] != null)
            {
                int ProjectId = Convert.ToInt32(Session["ProjectId"]);
                ProTrakEntities objEntity = new ProTrakEntities();
                Project objProject = (from p in objEntity.Projects where p.ProjectId == ProjectId select p).First();
                DateTime dueDate = Convert.ToDateTime(dtDuedate.DbSelectedDate.ToString());
                objProject.DueDate = dueDate;
                
                objProject.StatusId = Convert.ToInt32(cmbStatus.SelectedValue);
                objEntity.SaveChanges();    
                Session["Statusid"] = Convert.ToInt32(cmbStatus.SelectedValue);        
                Response.Redirect("Default.aspx");
            }
        }
     
    I'm using "Response.Redirect("Default.aspx")" to display the updatedvalue of status.After updating when i click a combobox it displays popup,but when select the main grid row to display the details of another project,the popup not woking and combobox diplaying the previous project status.If i go fro any action the value of combobox not changing.but if i refresh the page it displays the popup and updating working fine if click anything again same problem no popup.So if want to update status each and every time i need to refresh but this is not the way.

    Thanks and Regards,
    Tirumalesh
                     
                      
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1268 posts

    Posted 12 Oct 2011 Link to this post

    Hi Tirumalesh,

    I've inspected the sample code provided, but I'm unable to define what is causing the experience problem.
    Please open support ticket and try to provide a runnable sample page so I could troubleshoot the issue locally.

    Kind regards,
    Dimitar Terziev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top