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:TemplateField HeaderText="ord_date" SortExpression="ord_date">
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" 
                            Text='<%# Bind("ord_date", "{0:d}") %>'></asp:TextBox>
                        <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/calendar.gif" />
                        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" 
                            PopupButtonID="ImageButton1" TargetControlID="ord_date">
                        </cc1:CalendarExtender>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("ord_date", "{0:d}") %>'></asp:Label>
                        &nbsp;<br />
                    </ItemTemplate>
                </asp:TemplateField>

and aspx code of update:

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.

Recommended Answers

All 2 Replies

Hi

Try to find the value of the grid's control

Dim MyTxt As TextBox

MyTxt = CType(Mygridview.FindControl("ord_Date"), TextBox)

Let me know if it solves your problem!

Sorry, it didnt worked.
Still not updating.

what else to do?
Thanks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.