Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i built my application on visual studio 2005 and .net 2.0,sql server 2005
my WebUserControl code is


XML
<table cellpadding="0" cellspacing="1" border="0" width="100%">
    <tr>
        <td colspan="3" align="left">
            <asp:GridView ID="GridViewUserScraps" ItemStyle-VerticalAlign="Top" AutoGenerateColumns="False"
                GridLines="None" Width="100%" ShowHeader="False" runat="server" AlternatingRowStyle-BackColor="#A5A5A5"
                CellPadding="4" ForeColor="#333333" Height="385px">
                <Columns>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <table align="left" cellpadding="1" cellspacing="2">
                                <tr>
                                    <td>
                                        <a href='<%#getUserHREF(Container.DataItem)%>'>
                                            <img align="middle" src='<%#getSRC(Container.DataItem)%>' border="0" width="50px" /></a>
                                    </td>
                                    <td>
                                        &nbsp;</td>
                                </tr>
                            </table>
                            <div>
                                <%#DataBinder.Eval(Container.DataItem, "Message")%>
                                <br />
                                <br />
                            </div>
                            <span class="SmallBlackText">Posted On: &nbsp;</span>
                            <asp:Label ID="lblSendDate" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"SendDate")%>'></asp:Label>
                            </span>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <RowStyle BackColor="#EFF3FB" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#2461BF" />
                <AlternatingRowStyle BackColor="White" />
            </asp:GridView>
        </td>
    </tr>
</table>



errro is

Element img is missing reqired attribute alt

and another error in my code is

MSIL
Error   8   The type 'System.Web.UI.ScriptManager' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.   C:\Users\omar\Documents\Visual Studio 2005\WebSites\WebSite8\Header.ascx    3
Posted

1 solution

Both of the errors are quite descriptive. The first one about the alt tag is because your img tag doesn't have any alt-text which is required, so you need to add some:

<img align="middle" src='<%#getSRC(Container.DataItem)%>' border="0" width="50px" alt="My Alt Text" />

The second tells you that you should add a reference to System.Web.Extensions you can do that by right clicking the References folder in the solution explorer, choosing 'Add Reference' and then scrolling through the list of .Net Assemblies until you find the one you need.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900