Problem with Edit/Update in GridView...

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2008
Posts: 5
Reputation: b007 is an unknown quantity at this point 
Solved Threads: 0
b007 b007 is offline Offline
Newbie Poster

Problem with Edit/Update in GridView...

 
0
  #1
Nov 28th, 2008
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:
  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:
  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.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 68
Reputation: reach_yousuf is an unknown quantity at this point 
Solved Threads: 13
reach_yousuf reach_yousuf is offline Offline
Junior Poster in Training

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

 
0
  #2
Nov 29th, 2008
Hi

Try to find the value of the grid's control

  1. Dim MyTxt As TextBox
  2.  
  3. MyTxt = CType(Mygridview.FindControl("ord_Date"), TextBox)

Let me know if it solves your problem!
Yousuf
Software Developer
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: b007 is an unknown quantity at this point 
Solved Threads: 0
b007 b007 is offline Offline
Newbie Poster

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

 
0
  #3
Nov 29th, 2008
Sorry, it didnt worked.
Still not updating.

what else to do?
Thanks...
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC