How to show a value from a variable from code behind in the ascx-file ?

  1. #1

    How to show a value from a variable from code behind in the ascx-file ?

    Hello World,

    I have searched but not found - maybe you can help me.
    :-)

    I have a variable with a value in the code behind file *.ascx.cs
    which I would like to show in my *.ascx file for the user.

    How shall I do that ?

    In this code I have tried

    <%= myVariableFromCOdeBehind %>
    but I got ASP.NET runtime error: Code blocks are not supported in this context.

                                <ext:Tab ID="TabDocuments" runat="server" Title="DokumentABC" Border="false">
                                    <Body>
                                        <ext:FitLayout runat="server">
                                            <ext:DataView runat="server" StoreID="DocumentStore" ItemSelector="span:first-child">
                                                <Template ID="Template1" runat="server">
                                                    <tpl for=".">
                                                        <span style="float:left;
                                                                     padding: 3px 5px 3px 5px;
                                                                     text-align:left;">
                                                            <div style="width: 100px;" ><b><%= allDocuments[0].getDocumentName() %>:</b><br /><a href="/pages/downloaddocument/DownloadDocumentHelper.aspx?id={RevisionGuid}&type=SupplierDocument" target="_blank" > {DocumentTitle}</a></div>
                                                        </span>
                                                    </tpl>                                      
                                                </Template>	
                                            </ext:DataView>
                                        </ext:FitLayout>
                                    </Body>
                                </ext:Tab>

    Any advice to a confused programmer ?!?!
    Last edited by geoffrey.mcgill; May 25, 2011 at 2:49 PM. Reason: please use [CODE] tags
  2. #2
    Hi,

    The Template loops client side based upon the Store data, so writing in a unique server-side variable for each record is not possible.

    I think you'll need to pass the {DocumentName} in the Store data.
    Geoffrey McGill
    Founder
  3. #3

    Ok - another option

    Well, is it possible in some way to do something for this statement
    <tpl for=".">
                            <span style="float:left;
                                         padding: 3px 5px 3px 5px;
                                         text-align:left;">
                                <div style="width: 100px;" ><b><b>{CategoryName}:</b>:</b><br /><a href="/pages/downloaddocument/DownloadDocumentHelper.aspx?id={RevisionGuid}&type=SupplierDocument" target="_blank" > {DocumentTitle}</a></div>
                            </span>
                        </tpl>
    As it is right now, the answer from this statement puts all objects in one row.
    It is growing to the right at the line.

    I would for example put a <br> after 3-4 objects so I could get in this case two lines.

    ???
    Last edited by Daniil; May 26, 2011 at 7:01 AM. Reason: Please use [CODE] tags
  4. #4

Similar Threads

  1. Replies: 2
    Last Post: Apr 10, 2012, 12:08 PM
  2. checkbox don't fire in .ascx file
    By yyyhxm1 in forum 1.x Help
    Replies: 1
    Last Post: Aug 30, 2010, 11:06 PM
  3. Replies: 0
    Last Post: Apr 15, 2010, 7:25 AM
  4. tabpanel, selected tab and refreshing ascx file
    By JsonTerre in forum 1.x Help
    Replies: 0
    Last Post: Feb 10, 2009, 10:55 PM
  5. Replies: 3
    Last Post: Nov 27, 2008, 12:52 PM

Posting Permissions