Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
347 views
I have a dynamically added usercontrol that dynamically creates a TabStrip and associated PageViews from a database. For SEO purposes what I want this to do is create the PageViews for some of the tabs initially but also have some of the Tabs that will dynamically add thier PageViews on TabClick. Some of these also get additional user controls added to the PageView.

The problem is that the tabs with PageViews work fine until I click one that loads another page OnPostBack. Once the new PageView is dynamacally added OnPostBack I loose all of the ones that were originally created.

I believe I need to use the multipage PageViewCreated event to persist the dynamically created controls inside a RadPageView such as what is shown on this demo http://demos.telerik.com/aspnet-ajax/tabstrip/examples/applicationscenarios/loadondemand/defaultcs.aspx.

My problem is I am adding the content to the initially created PageViews by placing it into a Literal using Controls.Add which works fine initially. The problem is I can't seem to find it using e.PageView.FindControl to persit it in the PageViewCreated event below which always shows "PageView not found" in the code below.

Any help would be greatly appreciated!

Thanks in advance,
Dave

protected void Page_Load(object sender, EventArgs e)
       {
           if (!Page.IsPostBack)
           {
               LoadPageTabs(intControlID);
 
               if (Convert.ToInt32(SessionHandler.UserLevel) > 9)
               {
                   RadMenu1.Visible = true;
                   ScriptBlock1.Visible = true;
                   RadTabStrip1.OnClientContextMenu = "ShowRadMenu";
                   RadTabStrip1.OnClientTabSelected = "OnClientTabSelected";
               }
 
               ConfigureRadEditor();
           }
 
       }
 
       protected void LoadPageTabs(int intPageID)
       {
           PageLogic pl = new PageLogic();
           DataTable dt = pl.GetPageTabs(0, intPageID, 0);
           if (dt.Rows.Count > 0)
           {
 
               if (!Page.IsPostBack)
               {
                   lblPgTabID.Text = dt.Rows[0]["PgTabID"].ToString();   
               }
 
               foreach (DataRow dr in dt.Rows)
               {
                   try
                   {
                       AddTab(Convert.ToInt32(dr["PgTabID"].ToString()), Convert.ToInt32(dr["ParentID"].ToString()), dr["TabName"].ToString(), Convert.ToInt32(dr["ShowPv"].ToString()), dr["PvContent"].ToString(), dr["PvControl"].ToString(), Convert.ToInt32(dr["PvControlID"].ToString()));
                   }
                   catch (Exception)
                   {
                       throw;
                   }
               }
           }
           else
           {
               phAddTab.Visible = true;
               phTabs.Visible = false;
           }
       }
 
 
       private void AddTab(int intPgTabID, int intParentID, string tabName, int intShowPv, string pvContent, string pvControl, int pvControlID)
       {
           RadTab ParentTab = new RadTab();
           //tab.ID = "tb" + tabName;
           ParentTab.Text = tabName;
           ParentTab.Value = intPgTabID.ToString();
           ParentTab.Attributes.Add("TabID", intPgTabID.ToString());
           RadTabStrip1.Tabs.Add(ParentTab);
 
           if (intParentID < 0)
           {
               PageLogic pl = new PageLogic();
               DataTable dt = pl.GetPageTabs(0, 0, intPgTabID);
               if (dt.Rows.Count > 0)
               {
                   int rowcnt = 0;
                   foreach (DataRow dr in dt.Rows)
                   {
                       try
                       {
                           RadTab ChildTab = new RadTab();
                           ChildTab.Text = dr["TabName"].ToString();
                           ChildTab.Value = intPgTabID.ToString();                         
                           ChildTab.Attributes.Add("TabID", dr["PgTabID"].ToString());
                           ParentTab.Tabs.Add(ChildTab);
                           if (intShowPv > 0)
                           {
                               AddPageView(ChildTab, Convert.ToInt32(dr["PgTabID"].ToString()), dr["PvContent"].ToString(), dr["PvControl"].ToString(), Convert.ToInt32(dr["PvControlID"].ToString()));
                           }
                           if (rowcnt == 0)
                           {
                               ChildTab.Selected = true;
                           }
 
                           rowcnt++;
                            
                       }
                       catch (Exception)
                       {
                           throw;
                       }
                   }
               }
 
           }
 
           if (intParentID < 1)
           {
               if (intShowPv > 0)
               {
                   AddPageView(ParentTab, intPgTabID, pvContent, pvControl, pvControlID);
               }
           }
 
       }
 
 
       private void AddPageView(RadTab tab, int intPgTabID, string pvContent, string pvControl, int pvControlID)
       {
           Literal litPvContent = new Literal();
           litPvContent.Text = pvContent;
           litPvContent.ID = "litPv" + intPgTabID.ToString();
 
           RadPageView pageView = new RadPageView();
           // pageView.ID = tabName;
            
           pageView.ID = intPgTabID.ToString();
           pageView.Controls.Add(litPvContent);
            
           if (pvControl.Length > 0)
           {
               UserControl userControl = (UserControl)this.LoadControl(pvControl);
               ((CustomControl)userControl).ID = "Cntl" + intPgTabID.ToString();
               ((CustomControl)userControl).intControlID = pvControlID;
               ((CustomControl)userControl).intPgMode = 2;
               pageView.Controls.Add(userControl);
           }
 
           RadMultiPage1.PageViews.Add(pageView);
           tab.PageViewID = pageView.ID;
       }
 
 
       private void AddHiddenPageView(RadTab tab)
       {
           int intPgTabID = Convert.ToInt32(tab.Value);
           PageLogic pl = new PageLogic();
           DataTable dt = pl.GetPageTabs(intPgTabID, 0, 0);
           if (dt.Rows.Count > 0)
           {
               Literal litPvContent = new Literal();
               litPvContent.Text = dt.Rows[0]["pvContent"].ToString();
 
               RadPageView pageView = new RadPageView();
               // pageView.ID = tabName;
 
               pageView.ID = "pv" + intPgTabID.ToString();
               pageView.Controls.Add(litPvContent);
               //pageView.Visible = false;
 
 
               if (dt.Rows[0]["pvControl"].ToString().Length > 0)
               {
                   UserControl userControl = (UserControl)this.LoadControl(dt.Rows[0]["pvControl"].ToString());
                   ((CustomControl)userControl).ID = "Cntl" + intPgTabID.ToString();
                   ((CustomControl)userControl).intControlID = Convert.ToInt32(dt.Rows[0]["pvControlID"].ToString());
                   ((CustomControl)userControl).intPgMode = 2;
                   pageView.Controls.Add(userControl);
               }
 
               RadMultiPage1.PageViews.Add(pageView);
               tab.PageViewID = pageView.ID;
           }
       }
 
       protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)
       {
           Literal litPvContent = new Literal();
           litPvContent.ID = "litPv1" + e.PageView.ID.ToString();
 
           Literal litPvContent1 = (Literal)e.PageView.FindControl("litPv" + e.PageView.ID.ToString());
 
           if (litPvContent1 != null)
           {
               litPvContent.Text = litPvContent1.Text;
               e.PageView.Controls.Add(litPvContent);
           }
           else
           {
               litPvContent.Text = "PageView Not Found";
           }
 
           e.PageView.Controls.Add(litPvContent);
 
           //string userControlName = e.PageView.ID + "CS.ascx";
 
           //Control userControl = Page.LoadControl(userControlName);
           //userControl.ID = e.PageView.ID + "_userControl";
 
           //e.PageView.Controls.Add(userControl);
 
       }
 
       protected void RadTabStrip1_TabClick(object sender, RadTabStripEventArgs e)
       {       
           AddHiddenPageView(e.Tab);
           e.Tab.PageView.Selected = true;
       }

Nencho
Telerik team
 answered on 18 Oct 2012
1 answer
95 views
When a user modifies a schedule is there a way to detect on the server if the appointment and the modified appointment are the same, in other words, there are no changes? Or client side is there a way to simply call the cancel submit when save is clicked with no changes?

I cannot find any way to do a compare on the appointment and the modified appointment that is built in and would cover all information passed from the form.

Thanks!
Plamen
Telerik team
 answered on 18 Oct 2012
1 answer
119 views
Hi there,

while placing a long name in Split button of rad ToolBar. I am getting a white backGround Color behind the button text on Mouse over.
Below is code snippet.

<telerik:RadToolBar ID="testId" runat="server" Skin="Outlook">
                    <Items>
                        <telerik:RadToolBarButton runat="server" CommandName="cmd1" ToolTip="cmd"  ImageUrl="./cmd.png" />
                        <telerik:RadToolBarButton IsSeparator="true" />
                        <telerik:RadToolBarSplitButton CommandName="textoo1" Value="textoo1
" Width="100%" OuterCssClass="../cmd.png"  >
                        <Buttons>
                               <telerik:RadToolBarButton runat="server" Text="ddddddddddddddddddddddddddddd dddddddddddddddddddddddddddaasassakk kkkkkkkkkkkkk kkkkkkkkkkkkkkkkkk" ></telerik:RadToolBarButton>
                        </Buttons>
                        </telerik:RadToolBarSplitButton> 
                    </Items>
                </telerik:RadToolBar>
Kate
Telerik team
 answered on 18 Oct 2012
0 answers
167 views
I have 5 web applications running on the same server. The code is identical between each application, differences being web.config, theme, etc.  Three of the applications upload files successfully while the other two fail with the following event being logged : "The process cannot access the file because it is being used by another process."

I'm fairly convinced this is an environmental problem, but I've triple checked and all of the applications are set-up the same in IIS and the permisssions on the folders are also the same.

Also, the files are uploaded to the temp directory and remain as random named files, and the error occurs when I clcik the "Save Documents" built in button.

Does anyone have any idea's on what could be causing this?

Thanks,
Joe
Joseph
Top achievements
Rank 1
 asked on 18 Oct 2012
3 answers
137 views
Hi

i am using radcalender. i need to display calender  month view horizontally .
everything is working fine but problem is that its not hiding the OtherMonthsDay name.

<telerik:RadCalendar ID="rcJan" runat="server" SingleViewColumns="31"
    SingleViewRows="1" FocusedDate="2012-01-01" ShowOtherMonthsDays="false">
</telerik:RadCalendar>
Its showing only 24 days from month.
Thanks
Vasil
Telerik team
 answered on 18 Oct 2012
2 answers
94 views
I try:
radChart1.PloatArea.Appearance.Dimensions.AutoSize = false;
radChart1.PloatArea.Appearance.Dimensions.Height = 300;
radChart1.PloatArea.Appearance.Dimensions.Width = 800;

The line: radChart1.PloatArea.Appearance.Dimensions.Height = 300; its work, but the line width no.

How can I do to enlarge(width) my ploatarea? How do I do to align all Chart Area?

Ciro
Top achievements
Rank 2
 answered on 18 Oct 2012
8 answers
252 views
I have a paginated RadGrid populated server-side via NeedDataSource. Pagination is handled via AJAX. When we scroll down the results in the grid, hit the next page button, we want the scroll bar to be reset back to the top of the gird. Currently, it is persisting to its last position.

I've tried both solutions in this post: http://www.telerik.com/community/forums/aspnet-ajax/grid/reset-scrollbar-to-top.aspx

Is there a solution for this? And why doesn't SaveScrollPosition="False" work? We are using version 2011.1.519.35 of Telerik.Web.UI.

Thanks.
Pavlina
Telerik team
 answered on 18 Oct 2012
1 answer
107 views
iOS 6 allows for photos and videos to be uploaded via safari. Everything works well on the AsyncUplod including the server side FileUploaded event. However, when I try to access the InputStream via e.File.InputStream I get a null / file not found exception. I can watch the temporary folder where the file gets uploaded to and no file is ever written there. All of the server side and client side events fire like normal without the file ever being written to the server.

Am I missing something here or is there a bug for safari on the iPad?
Bozhidar
Telerik team
 answered on 18 Oct 2012
3 answers
374 views
Hi,

I set  EnableAsyncUpload="True" for ImageManager, MediaManager..., but cannot find where to set TemporaryFolder for AsyncUpload of the editor. It is using the default ~/App_Data/RadUploadTemp. Is there any way to change it?

Thanks.
Rumen
Telerik team
 answered on 18 Oct 2012
11 answers
224 views
Hi

Im using RadMaskedTextBox for phone input in my project, in that im facing issue like copy/paste is not working with IE browser and its fine Mozilla. Need to add any additional stuff to overcome this? help me to solve this problem.

<telerik:RadMaskedTextBox ID="txtOrgFax" Mask="(###) ###-####" PromptChar=" " runat="server">                                       </telerik:RadMaskedTextBox>

looking for ur response

Regards
Jai.
Vasil
Telerik team
 answered on 18 Oct 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?