Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
523
Template Field and Images
posted

I have a multiview in my page, in the first view I have a grid with a template field, and some other bound fields, I load the grid in the page load and I can edit the selected record in the second view of the multiview not inline in the grid. The error happens when I hit cancel the operation, the first view is selected and the image in the template field is missing. When I looked at the source code of the page the imag has its attribute src="". Why is that?

Here is my code

<ig:WebDataGrid ID="gridUsuarios" runat="server" Height="350px" Width="99%" AutoGenerateColumns="False"
                OnInitializeRow="gridUsuarios_InitializeRow" EnableDataViewState="True">
                <Columns>
                    <ig:BoundDataField DataFieldName="IdUsuario" Hidden="True" Key="IdUsuario">
                        <Header Text="ID" />
                    </ig:BoundDataField>
                    <ig:BoundDataField DataFieldName="Codigo" Key="Codigo" Width="100px">
                        <Header Text="Código" />

                    </ig:BoundDataField>
                    <ig:BoundDataField DataFieldName="Nombre" Key="Nombre">
                        <Header Text="Nombre" />
                    </ig:BoundDataField>
                    <ig:BoundDataField DataFieldName="Email" Key="Email">
                        <Header Text="Correo Electrónico" />
                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Perfil" Key="Perfil" Width="100px">
                        <Header Text="Perfil" />
                    </ig:BoundDataField>
                    <ig:TemplateDataField Key="Activo" Width="80px">
                        <ItemTemplate>
                            <asp:Image ID="imgActivo" runat="server" Width="15px" Height="15px" />
                        </ItemTemplate>
                        <Header Text="Activo" />
                    </ig:TemplateDataField>
                </Columns>
                <Behaviors>
                    <ig:Selection CellClickAction="Row" RowSelectType="Single" Enabled="true">
                    </ig:Selection>

                    <ig:RowSelectors Enabled="true">
                    </ig:RowSelectors>
                    <ig:Paging Enabled="true" PageSize="10">
                    </ig:Paging>
                </Behaviors>
            </ig:WebDataGrid>

 

And the codebehind:

protected void Page_Load(object sender, EventArgs e)
    {

        if (!IsPostBack)
        {
            gridUsuarios.DataSource = GetData();
            gridUsuarios.DataBind();
        }
    }

    protected void gridUsuarios_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)
    {

        Image imagen = e.Row.Items[5].FindControl("imgActivo") as Image;
        if (((DatosUsuarios)e.Row.DataItem).Activo)
            imagen.ImageUrl = "~/Imagenes/Aceptar.png";
        else
            imagen.ImageUrl = "~/Imagenes/Cancelar.png";

    }

The first time the page is loaded

 

The error and the source

 

  • 523
    posted

    Is there any solution to this problem??? I've been waiting for weeks for an answer but nothing.

    Is always the support like this??? I am a customer of infragistics. Is there any "advantage" on support? Learn from Coolite, they are few but the support is fantastic.

    Please, say something.