|
Hi All,
I have an asp ImageButton within a gridview. Normally, I click the button, and the row upon which the button is in, is deleted.
It worked well for a long time, until one day it didn't.
I have spend exactly 12 hours now trying to work out what has happened, and I have found the problem.... I just don't know how to solve it.
The problem comes from me having added a custom control to the page.
I registered the control like this:
<%@ Register TagPrefix="user" TagName="AddressForm" Src="UserControl/AddressForm.ascx" %>
The control is pulled into the page like this:
<fieldset style="margin-left:10px;margin-right:10px">
<div class="cart_spacer"></div>
<legend><span style="color:#c90101;font-size:12px; font-family: Arial, Helvetica, sans-serif">Shipping Address</span></legend>
<div style="padding:5px 5px 5px 5px" class="productSubHeading">
Enter the address where you would normally want your order shipped. <br /><i class="cart_small">(this can be changed whenever you place an order)</i>
</div>
<div class="cart_spacer"></div>
<user:AddressForm
id="shippingAddress"
ShowCopyCheckBox="False"
CopyCheckBoxText=""
Runat="server" />
</fieldset>
The Gridview looks like this:
<asp:GridView ID="grd_Cart" runat="server"
AutoGenerateColumns="False" Width="100%"
OnRowDataBound="grdCart_RowDataBound"
DataKeyNames="TempDetId"
DataSourceID="sqlGrdCart"
GridLines="None"
BorderColor="#CCCCCC"
BorderWidth="1px"
BorderStyle="Solid"
AlternatingRowStyle-BackColor="#F2F2F2"
HeaderStyle-BorderColor="#CCCCCC"
HeaderStyle-BorderStyle="Solid"
HeaderStyle-BorderWidth="1px"
EmptyDataText="There are no items in your shopping cart"
>
<Columns>
<asp:BoundField DataField="TempDetID" Visible="false" ShowHeader="false" />
<asp:TemplateField>
<ItemTemplate>
<a href="ShowImage.ashx?img=<%#Eval("SwatchImage")%>&path=BlindsImages" class="lboxImg">
<img src='ShowImage.ashx?img=<%#Eval("SwatchImage")%>&h=30&w=30&path=BlindsImages' title="click for larger image" width="40px" style="text-align:center" alt='<%#Eval("SwatchImage")%>' style="border:0px;" /></a>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description" HeaderStyle-CssClass="headerstyle" HeaderStyle-HorizontalAlign="Left" ShowHeader="true" HeaderStyle-VerticalAlign="Middle">
<ItemTemplate>
<asp:Label ID="lblDesc" runat="server" style="padding:5px 5px 5px 5px" Width="270px" text='<%# Eval("LineDesc") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty" HeaderStyle-Width="30px" HeaderStyle-HorizontalAlign="Center" ShowHeader="true">
<ItemTemplate>
<asp:TextBox ID="txtQty" runat="server" alt='<%# Eval("TempDetId") %>'
AutoPostBack="false"
onchange="CheckPostBack(this);updateQty(this.alt,this.value)" style="padding:5px 2px 5px 2px; text-align:center" width="30px" Text='<%# Bind("Qty") %>'></asp:TextBox>
<asp:RangeValidator ID="valQty" Type="Integer" MinimumValue="1" MaximumValue="1000" ControlToValidate="txtQty" runat="server" ErrorMessage="*"></asp:RangeValidator>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>
<asp:BoundField DataField="OrigPrice" HeaderText="Price Each" ItemStyle-Font-Strikeout="true" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px" DataFormatString="{0:C}" HtmlEncode="false" SortExpression="OrigPrice" >
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="SalePrice" HeaderText="Web Price" ItemStyle-ForeColor="Red" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="50px" DataFormatString="{0:C}" HtmlEncode="false" SortExpression="SalePrice" >
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle Width="50px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Delivery or Installation?" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
HeaderStyle-Width="80px" ItemStyle-Font-Size="10px" ShowHeader="true">
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:Label runat="server" ID="lblDelType" style="padding:5px 2px 5px 2px; text-align:center" Width="100%" Text='<%# Eval("DelType") %>'></asp:Label>
</ContentTemplate>
<Triggers><asp:AsyncPostBackTrigger ControlID="butPostBack" EventName="Click"/> </Triggers>
</asp:UpdatePanel>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>
<asp:TemplateField ShowHeader="false" ItemStyle-Width="30px">
<ItemTemplate>
<asp:ImageButton ImageUrl="images/TrashCan.gif" runat="server" CommandArgument='<%# Eval("TempDetId") %>'
OnCommand="butDel"
CommandName="Delete" ToolTip="Delete / Remove" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
So can anyone tell me why my imagebutton won't fire any code event when this user:AddressForm is on the page? If i remove it from the page but leave the register block in there, it all works fine.
Apologises for posting so much code, I am anticipating that you'll need to see it.
|
|
|
|
|
Put your update panel outside your grid, see if that works. Had similar problem when i used update panel inside a grid.
|
|
|
|
|
Thanks for the info, but I've tried that already during the elimination process.
Besides, the msdn docs show what I've done as an example with Update panels.
http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx
Prior to this problem, I had the whole Grid in an update panel, because I didn't realise you could put an UPan in an item template.
The problem is definately associated with this custom control... if I remove the control, everything works nicely.
|
|
|
|
|
Does this runs? The update panel does not contains any control with ID "butPostBack".
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
yes the button is located elseewhere on the page and is called from js to fire a partial page postback.
|
|
|
|
|
Hello all,
I am using customErrors of Web.config file in my application so that to redirect the user to an error page on exception.
But after getting exception i am not redirecting to the erropage.
Am i missing something?
I am using this code in my web.config:
<customErrors mode="On" defaultRedirect="ErrorPage.aspx">
</customErrors>
|
|
|
|
|
|
I tried couple of things mentioned in the article but i m still not achieving the result.
|
|
|
|
|
I am using VS2005 and installed AJAX Extensions and AJAX Toolkit 1.0.20229.
When i create the AJAX controls from designer file its working fine (the created control is also being referenced in code behind file). But when i try to create an AJAX control from code behind file its not working.
Please help me out in this.
Thanks,
Santa
|
|
|
|
|
Did you imported the namespace of Toolkit ?
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
How to do the above process.
Thanks in Advance.
|
|
|
|
|
I want to add one horizental line at the bottome of my master page:
... (some other controls)
</form>
<hr />
</body>
however, this line is always displayed at the top of the body.
anyone can give me one hint what is the possible reason?
|
|
|
|
|
Seraph_summer wrote:
however, this line is always displayed at the top of the body.
You have to put it inside Table .
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
thanks, I have tried as follows, unfortunately,it gives the same behaviour
<table style="width: 100%;">
<hr />
</table>
|
|
|
|
|
width: 100%;height: 100%">
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
modified on Saturday, September 12, 2009 6:46 AM
|
|
|
|
|
[Edit] Now it looks Good [/Edit]
[Edit2]Broken Again [/Edit2]
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
modified on Saturday, September 12, 2009 7:05 AM
|
|
|
|
|
Where is TR and TD ? This is very common mistake that we do. Please put HR inside TR > TD Then Check.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
modified on Saturday, September 12, 2009 6:47 AM
|
|
|
|
|
I tried as follows, but nothing is special, the line is always displayed on the top!
<table style="width: 100%;height:100%">
<tr>
<td>
<hr />
</td>
</tr>
</table>
modified on Saturday, September 12, 2009 11:15 AM
|
|
|
|
|
We are planning to do a twitter like social networking application.Is there any sample code that we can refer for creating micro blogging application like twitter?
|
|
|
|
|
How much have you done up to now? If you need to ask a question like this you are probably working on the wrong project.
|
|
|
|
|
Bithu wrote: twitter like social networking application
You better ask twitter to get your answer.
Anyway, it's upto you how you want to have your architecture. Try out with simple .NET application with multiple users. Then see how much you want to scale up...Anyway, best of luck...
|
|
|
|
|
Hi. Im generating half my page with normal html and half from the code behind.
<normalhtmlstuff>
<p id=<asp:label>>
</normallhtmlstuff>
Ok, you can get the idea of what i need. Problem is that when doing it like that and changing the labels to something it comes out like id=<pre>"myid"<pre> or something to that effect.
Thanks
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
You need to use a literal if you want to insert HTML and not have the code convert it into visible text.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Thank you
Strive to be humble enough to take advice, and confident enough to do something about it.
|
|
|
|
|
any one know how handle this error in web.config
Error Message: Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element.
Warning 2
The 'requirePermission' attribute is not declared.
|
|
|
|