| | |
Grid View row cell becomes TextBox
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
Dear all,
I use asp:button field in my gridview
The problem is, everytime I clicked 'edit' and 'approve' button in gridview, the row cell became TextBox, and can be edited by user also the date became '04/01/2009 12:00:00 AM' difference with the format.
Any suggestion ? please.
Thanks.
I use asp:button field in my gridview
ASP.NET Syntax (Toggle Plain Text)
<asp:GridView ID="GV" runat="server" DataSourceID="SDSInHouseRate" Width="100%" AutoGenerateColumns="False" OnRowCommand="GV_RowCommand" OnRowCreated="GV_RowCreated"> <Columns> <asp:buttonfield buttontype="Button" commandname="edit" text="Edit"/> <asp:buttonfield buttontype="Button" commandname="approve" text="Approve"/> <asp:BoundField DataField="Seq" HeaderText="Seq" SortExpression="Seq" /> <asp:BoundField DataField="CurrencyID" HeaderText="CurrencyID" SortExpression="CurrencyID" /> <asp:BoundField DataField="EffectiveDate" HeaderText="Effective Date" SortExpression="EffectiveDate" DataFormatString="{0:yyyy-MM-dd}" HtmlEncode="False" /> <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="Remark" /> <asp:BoundField DataField="CreatedBy" HeaderText="CreatedBy" SortExpression="CreatedBy" /> <asp:BoundField DataField="DateCreated" HeaderText="Date Created" SortExpression="DateCreated" DataFormatString="{0:yyyy-MM-dd HH:mm:ss}" HtmlEncode="False"/> </Columns> </asp:GridView>
ASP.NET Syntax (Toggle Plain Text)
Sub GV_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then Dim editButton As Button = CType(e.Row.Cells(0).Controls(0), Button) editButton.CommandArgument = e.Row.RowIndex.ToString() Dim approveButton As Button = CType(e.Row.Cells(1).Controls(0), Button) approveButton.CommandArgument = e.Row.RowIndex.ToString() End If End Sub Sub GV_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Dim Index As Integer = Convert.ToInt32(e.CommandArgument) Dim Row As GridViewRow = GVInHouseRate.Rows(Index) Session("TransMode") = StatusTrans.EditMode If e.CommandName = "approve" Then ImgApprover.Disabled = False CmbCCY.Enabled = False DTEffectiveDate.Enabled = False TxtInHouseRate.Enabled = False TxtRemark.Enabled = False Else ButtonReady() FillData(Val(Row.Cells(2).Text.Trim)) ImgApprover.Disabled = True End If End Sub
The problem is, everytime I clicked 'edit' and 'approve' button in gridview, the row cell became TextBox, and can be edited by user also the date became '04/01/2009 12:00:00 AM' difference with the format.
Any suggestion ? please.
Thanks.
NEVER NEVER NEVER GIVE UP
•
•
Join Date: Apr 2009
Posts: 37
Reputation:
Solved Threads: 2
The command name of the button field might be 'edit' .. just check out
•
•
Join Date: Apr 2009
Posts: 37
Reputation:
Solved Threads: 2
<asp:buttonfield buttontype="Button" commandname="edit" text="Edit"/> See this line...The command name of the button field is given as 'edit' which is reserved for performing edit option ..so change the command name .
Last edited by peter_budo; May 15th, 2009 at 7:35 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
- Introducing myself)) (Community Introductions)
- data grid view (ASP.NET)
- Getting cursor position from grid view (C#)
- Footer In grid view (ASP.NET)
- searching through a grid view (ASP.NET)
- Grid View Updating Errors Pls Help me... (ASP.NET)
- Collapsing/Expanding a grid view row in a ASP.net Web form (ASP.NET)
- Help with Drop Downs and Grid View (ASP.NET)
- Editing a hyperlinkcontrl in a gridview (ASP.NET)
Other Threads in the ASP.NET Forum
- Previous Thread: looking for good sites
- Next Thread: get row values from gridview when checkbox selected
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownmenu dynamic dynamically edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv form gridview gudi iis image javascript list listbox menu mouse mssql nameisnotdeclared news novell numerical opera order parent problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security select serializesmo.table sessionvariables silverlight smoobjects software sql sql-server ssl tracking treeview typeof validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming wizard xsl





