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

[Solved] If statements within a tab LoadContentFrom to decide what to perform .

2 Answers 67 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
IQworks
Top achievements
Rank 1
IQworks asked on 13 Feb 2010, 07:56 PM
  Hi,
     I saw this example in your AnimationEffects.aspx
<% Html.Telerik().TabStrip()  
        .Name("TabStrip")  
        .HtmlAttributes(new { style = "margin-top: 200px; height: 163px;" })  
        .Effects(fx => 
        {  
            if ((string)ViewData["enabledAnimation"] == "height")  
            {  
                fx.Expand(properties => 
                        properties  
                               .OpenDuration((int)ViewData["heightOpenDuration"])  
                               .CloseDuration((int)ViewData["heightCloseDuration"]));  
            }  
            else  
            {  
                fx.Toggle().Opacity(properties => 
                    properties  
                        .OpenDuration((int)ViewData["opacityOpenDuration"])  
                        .CloseDuration((int)ViewData["opacityCloseDuration"]));  
            }  
        }) 

I have been trying combinations of this ...... . 
  tabstrip.Add()  
               .Text("Edit Company")  
               .HtmlAttributes(new { style = "background-color:blue;color:white;" })  
               .LoadContentFrom(LC =>      
                   {     
                      if(TempData["which"]== "Init")     
                      {     
                      LC.(Url.Action("CompanyForm", "Company", new {request="Edit", id = Convert.ToInt32(Session["CompanyIdToEdit"]) }));       
                      }     
                          else     
                      {         
                      LC.(Url.Action("CompanyForm", "Company", new {request="Editerror", id = 0}));       
                      }     
                   });     
 

The first thing it tells me is that the "LC" after the LoadContentFrom "Cannot convert lambda expression to type 'string' because it is not a delegate type".
And, I get "identifier expected" between the "LC" and the (Url.Action, etc)
Is there a sample of how to do this with LoadContentFrom like your doing with Effects ? Maybe one that shows the right way that I
should be doing this ?
As usual, thanks for your time


  

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 Feb 2010, 08:09 AM
Hello IQworks,

You could use the following code:

TabStripItemBuilder tab = tabstrip.Add().Text("Edit Company");
if (TempData["which"]== "Init")
{
    tab.LoadContentFrom("", "", new { });
}else
{
    tab.LoadContentFrom("", "", new { });
}

You cannot use the code for setting the Effects because there us no overload of LoadContentFrom which supports that.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
IQworks
Top achievements
Rank 1
answered on 17 Feb 2010, 09:52 PM
  Atanas,
    Thank you for the sample code - it worked great and it helped me understand several other things as well. 
Tags
TabStrip
Asked by
IQworks
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
IQworks
Top achievements
Rank 1
Share this question
or