| | |
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 activexcontrol advice ajax alltypeofvideos application asp asp.net bc30451 bottomasp.net box browser button c# c#gridviewcolumn checkbox click commonfunctions confirmationcodegeneration css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose feedback fileuploader fill flash form formatdecimal forms formview grid gridview gudi homeedition hosting iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail rotatepage save schoolproject search security select silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos view virtualdirectory vista visualstudio web webapplications webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





