Dynamic Tab in MVC

  1. #1

    Dynamic Tab in MVC

    Hi Geoffrey,

    I'm having a hard time trying to do something very trivial with ASP.NET MVC Beta 1 and Coolite 0.6.0. I need to change the title on one Tab to some value stored in ViewData. I'm trying to do something like this:

        <ext:Tab ID="Tab1" runat="server" Title="<%= Html.Encode(ViewData["Title"]) %>" AutoScroll="true">
    but when I run it I get the error: "Server tags cannot contain <% ... %> constructs."

    Any ideas how I can accomplish this?

    Thanks

    - Juan
  2. #2

    RE: Dynamic Tab in MVC

    What about using:

    <ext:tab ... Title=' ... ' ...>
    
    </ext:tab>
    Timothy
  3. #3

    RE: Dynamic Tab in MVC

    Hi*Juan,

    Your code should work (I haven't tested to confirm), but you will have to call Tab1.DataBind() in your code-behind/view.*


    Geoffrey McGill
    Founder
  4. #4

    RE: Dynamic Tab in MVC

    oops...

    I just noticed something else, you will probably have to change the tag to the following.


    Example


    <ext:Tab ID="Tab1" runat="server" Title='<%= Html.Encode(ViewData["Title"]) %>' AutoScroll="true">

    Notice 'single-quotes' wrapping the Title value.


    Geoffrey McGill
    Founder
  5. #5

    RE: Dynamic Tab in MVC

    Thank you Geoffrey and Timothy. The single quote PLUS the Databind() did the trick.

    - Juan
  6. #6

    RE: Dynamic Tab in MVC

    No problem, you're using MVC. Have you had a chance to use buttons? If you have would you be able to post an example of how you are using it to submit?

    Cheers,
    Timothy
  7. #7

    RE: Dynamic Tab in MVC

    I do not use Ext:Button. I use the MVC Futures(http://www.codeplex.com/aspnet/Relea...eleaseId=18459) which contains a number of HTML helpers. Two of them are Html.SubmitImage and Html.SubmitButton. This is how I handle my submits.

    - Juan

Similar Threads

  1. Replies: 12
    Last Post: Sep 20, 2011, 2:33 PM
  2. [CLOSED] Create a dynamic event for dynamic components.
    By stoque in forum 1.x Legacy Premium Help
    Replies: 10
    Last Post: May 10, 2011, 9:16 PM
  3. Dynamic grid does not render in a dynamic panel
    By Wellington Caetano in forum 1.x Help
    Replies: 4
    Last Post: Apr 12, 2011, 9:19 PM
  4. Replies: 0
    Last Post: Mar 04, 2011, 12:05 PM
  5. Replies: 0
    Last Post: Mar 04, 2011, 6:46 AM

Posting Permissions