ImageButton in DataGrid wont submit when deployed to live

F

Frawls

I have a datagrid which contains an ImageButton.

This datagrid is in a control which is in an aspx page. the aspx page
contains the form:<form id="frmItemDetail" runat="server">

On my local machine the ImageButton submits my page fine. Everything
works fine locally. But when i deploy my site to the live server this
ImageButton will not even submit the page. thats right it doesnt EVEN
SUBMIT the page let alone submit it and then do nothing.

1 I have my databinding put inside if(!Page.IsPostBack) so that my
itemcommand does not get eaten when i click the imagebutton.

2 I have put the necessary code within private void
InitializeComponent()

3 I have created the necessary code for the item command private void
dgItemDetail_ItemCommand(object source, DataGridCommandEventArgs e)

4 i have added the CommandName atttribte to my ImageButton

I am completely stumped as to why this works fine on my local copy but
not on the live server.

I am hosting my site with a commercial hoster so i can attach a
debugger to the live process.

Here are some relevant bits of my code which may help. Any help would
be appreciated?????


--------------------------------------------------------------------------------------------------------------------------------------------------------------------
<asp:DataGrid ID="dgItemDetail"
Runat="server"
BorderWidth="0"
PagerStyle-CssClass="Paging"
AllowPaging="false"
AllowSorting="true"
AutoGenerateColumns="false"
PageSize="8">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>

<asp:Label ID="lblLongDescription" Text='<%#
Convert.ToString(DataBinder.Eval(Container.DataItem,"ItemDescription"))
%>' Runat=server >

<asp:ImageButton ID="bttnAddToCart" ImageUrl="../Images/
buttonAddLarge.gif" CommandName="cmdAddToCart" Visible="True"
Runat="server"></asp:ImageButton>

</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

------------------------------------------------------------------------------------------------------------------------------------------------------------------


override protected void OnInit(EventArgs e)
{

InitializeComponent();
base.OnInit(e);
}


private void InitializeComponent()
{
this.dgItemDetail.ItemDataBound +=new
DataGridItemEventHandler(dgItemDetail_ItemDataBound);
this.dgItemDetail.ItemCommand +=new
DataGridCommandEventHandler(dgItemDetail_ItemCommand);
this.Load += new System.EventHandler(this.Page_Load);
}

------------------------------------------------------------------------------------------------------------------------------------------------------------------


private void dgItemDetail_ItemCommand(object source,
DataGridCommandEventArgs e)
{
if(e.CommandName.ToString() != "Page") // paging command
{
//buttons
bttnAddToCart =
(ImageButton)e.Item.FindControl("bttnAddToCart");

if (((ImageButton)e.CommandSource).CommandName ==
"cmdAddToCart")
{
//add the item to the cart and redirect to the cart page
oCart.AddItemToCart(ItemID, dblChargeForMiniBasket,"0");

Page.Response.Redirect("SiteCart.aspx");
}
}
}

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
C

cs_in_va

On your ImageURL try using "~/images/filename" instead of ../images

I had same problem and that fixed it for me.
 
F

Frawls

Thanks for the reply cs_in_va. Itried using ~ but unfortunately it
didnt work....

Any other ideas? Why is this happening?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,697
Latest member
AugustNabo

Latest Threads

Top