This is a migrated thread and some comments may be shown as answers.

Exclude control from Ajax

0 Answers 19 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
vairam
Top achievements
Rank 1
vairam asked on 07 Aug 2009, 11:30 AM
Hi

I want the same functionality in this demo
http://demos.telerik.com/aspnet-ajax/scheduler/examples/export/defaultcs.aspx.
My problem is how to exclude the control from Ajax here i have included this line
 _ScriptManager.RegisterPostBackControl(imgexport);
even i am geting this error
Sys.webforms.pagerequestmanager parserErrorexception The message received from server canot be parsed common cause for this error are when the response is modified by calls to Response.Write();

My hole code is here

 public class AppTemplate : ITemplate

    {
        private DataTable dtfinalResult = new DataTable();
        private ScriptManager _ScriptManager;
      
        public AppTemplate(DataTable dtResult, ScriptManager ScriptManager)
        {
            dtfinalResult = dtResult.Copy();
            _ScriptManager = ScriptManager;
        }
       
        public void InstantiateIn(Control container)
        {
            ImageButton imgexport = new ImageButton();
            imgexport.CommandName = "Export";
            imgexport.ImageUrl = "/_layouts/images/smallOutlook.gif";
            imgexport.Width = new Unit(20);
            //imgexport.ID="Export"+
            //Exclude from the Ajax
            _ScriptManager.RegisterPostBackControl(imgexport);
            //imgexport.Attributes.Add("onclick", string.Format("realPostBack(this, \"\"); return false;"));
            container.Controls.Add(imgexport);

            Literal subject = new Literal();           
            subject.DataBinding += subject_DataBinding;           
            container.Controls.Add(subject);
            CalendarPlus calendarplus = new CalendarPlus(); 
           
       
        }

        private void subject_DataBinding(object sender, EventArgs e)
        {
            Literal subject = (Literal)sender;
            IDataItemContainer aptContainer = (IDataItemContainer)subject.BindingContainer;

            //Access the appointment object and set its AllowEdit property:
            SchedulerAppointmentContainer aptCont = (SchedulerAppointmentContainer)subject.Parent;
            Appointment app = aptCont.Appointment;
            int APPID = int.Parse(app.ID.ToString());
            app.AllowEdit = false;          
            //app.CssClass = "MyCustomAppointmentStyle";
            DataView dvFinalresult = dtfinalResult.DefaultView;
            dvFinalresult.RowFilter = "FieldID=" + APPID;
            DataTable dtCurrentApp = dvFinalresult.ToTable();                      
            string strSubject = HttpUtility.HtmlEncode((string)DataBinder.Eval(aptContainer.DataItem, "Subject"));
            if (dtCurrentApp.Rows.Count > 0)
            {
               // app.BackColor =System.Drawing.Color.FromName(dtCurrentApp.Rows[0]["color"].ToString());
                string scolor = dtCurrentApp.Rows[0]["color"].ToString();
                app.CssClass = "rsCategoryYellow";
                    if (bool.Parse(dtCurrentApp.Rows[0]["IsEditListItem"].ToString()))
                        subject.Text = "<span id=\"spanID\" style=\"padding-top:4px;padding-left:1px;padding-right:1px;padding-right:3px;margin-top:2px;margin:bottom:2px;height:100%;width:100%\" curDivDate=\"" + dtCurrentApp.Rows[0]["RecurrenceID"].ToString() + "\" title='' onmouseout=\"tooltip.hide();\" onmouseover=\"wsc_showmenu(this); return false\" ><A  HREF=\"javascript:void(window.open('" + dtCurrentApp.Rows[0]["URL"].ToString().Trim() + "'))\">" + strSubject + "</a></span>";
                    else
                        subject.Text = "<span id=\"spanID\" style=\"padding-top:4px;padding-left:1px;padding-right:1px;padding-right:3px;margin-top:2px;margin:bottom:2px;height:100%;width:100%\" curDivDate=\"" + dtCurrentApp.Rows[0]["RecurrenceID"].ToString() + "\" title='' onmouseout=\"tooltip.hide();\" onmouseover=\"wsc_showmenu(this); return false\" >" + strSubject + "</span>";
               
            }
            else
            {
                subject.Text = strSubject;
            }
        }
    }

Regards
Vairamuhu

No answers yet. Maybe you can help?

Tags
Scheduler
Asked by
vairam
Top achievements
Rank 1
Share this question
or