943,769 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 3029
  • ASP.NET RSS
Nov 28th, 2008
0

Problem with Edit/Update in GridView...

Expand Post »
Hi,
I just add a GridView with Edit option.
I connected it to DataSource.
Now, one field is a date, so I convert it's column to a template and added in the editItem template an ajax calendar extender which connected to the Texbox and works by clicking a button which I also added in the editItem template.
my problem is,
When the caldendar appears and I select a new date,
it show in the Textbox but when I press Update
the new date I just entered isnt update at all..
what I did wrong?

aspx code of editItem template:
asp.net Syntax (Toggle Plain Text)
  1. <asp:TemplateField HeaderText="ord_date" SortExpression="ord_date">
  2. <EditItemTemplate>
  3. <asp:TextBox ID="TextBox1" runat="server"
  4. Text='<%# Bind("ord_date", "{0:d}") %>'></asp:TextBox>
  5. <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/calendar.gif" />
  6. <cc1:CalendarExtender ID="CalendarExtender1" runat="server"
  7. PopupButtonID="ImageButton1" TargetControlID="ord_date">
  8. </cc1:CalendarExtender>
  9. </EditItemTemplate>
  10. <ItemTemplate>
  11. <asp:Label ID="Label1" runat="server" Text='<%# Bind("ord_date", "{0:d}") %>'></asp:Label>
  12. &nbsp;<br />
  13. </ItemTemplate>
  14. </asp:TemplateField>

and aspx code of update:
asp.net Syntax (Toggle Plain Text)
  1. UpdateCommand="UPDATE [sales] SET [ord_date] = @ord_date, [qty] = @qty, [payterms] = @payterms WHERE [stor_id] = @original_stor_id AND [ord_num] = @original_ord_num AND [title_id] = @original_title_id AND [ord_date] = @original_ord_date AND [qty] = @original_qty AND [payterms] = @original_payterms">

How to fix it.
Thanks.
Last edited by peter_budo; Nov 29th, 2008 at 5:59 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
b007 is offline Offline
5 posts
since Nov 2008
Nov 29th, 2008
0

Re: Problem with Edit/Update in GridView...

Hi

Try to find the value of the grid's control

ASP.NET Syntax (Toggle Plain Text)
  1. Dim MyTxt As TextBox
  2.  
  3. MyTxt = CType(Mygridview.FindControl("ord_Date"), TextBox)

Let me know if it solves your problem!
Reputation Points: 12
Solved Threads: 38
Junior Poster
reach_yousuf is offline Offline
194 posts
since Sep 2007
Nov 29th, 2008
0

Re: Problem with Edit/Update in GridView...

Sorry, it didnt worked.
Still not updating.

what else to do?
Thanks...
Reputation Points: 10
Solved Threads: 0
Newbie Poster
b007 is offline Offline
5 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: ASP.NET - session objects Problem
Next Thread in ASP.NET Forum Timeline: Different Languages in .Net





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC