Question

I have a strange issue in a datalist

<asp:DataList ID="dl" RepeatColumns="8" runat="server" GridLines="None" OnItemDataBound="dl_idb"
                        OnItemCommand="dl_ic" RepeatDirection="Horizontal">
                        <ItemTemplate>
                            <table border="0" cellpadding="0" cellspacing="0" style="margin-left: 15px; margin-right: 15px;">
                                <tr>
                                    <td>
                                        <li>


                                            <asp:ImageButton ID="imgMat" runat="server" Width="100" Height="100" ImageUrl='<%# DataBinder.Eval(Container, "DataItem.imgMat")%>'
                                                CommandArgument='<%# DataBinder.Eval(Container, "DataItem.Matid")%>' ToolTip='<%# DataBinder.Eval(Container, "DataItem.ImgMat")%>'
                                                CommandName="gallery"    />

                                        </li>

and on server side

protected void dl_IC(object source, DataListCommandEventArgs e)
    {
        try
        {

            if (e.CommandName.ToString() == "gallery")
            {

but when the page is load I am not able to click the image, i.e. it is not in clickable mode while when I open the same page in Firefox or Chrome I can click the image and Item command event is also firing.

Additional Info

  • I am binding the datalist in > If(!ispostback) event
  • on Row Databound I am doing this

ImageButton imgM = (ImageButton)e.Item.FindControl("imgMat"); imgM .Attributes.Add("onload", "DoSomething('" + string value + "'," + 0 + ")");

Any help ?

Was it helpful?

Solution

Not positive if this is your problem or not, but you're server side method is "dl_IC" while the client side OnItemCommand is set to "dl_ic". Try making them match case and see if it's more reliable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top