Click here to Skip to main content
11,645,087 members (67,560 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I have one Grid d view in that i have used bound Field to Bind the grid view
also i have fired the 4 Even
1) Row Command
2) Row Editing
3) Row Deleting
4) Page Index Changing Events.
 
while I click on The Edit button of the Gridview which i have taken in Template Field. In code behind in Row command event it fetch the all details using Command Arguments. and fill the data in webform.
 
The issue is when while am clicking two time of Edit button in gridview my gridview row converted into the text. while i have not used any textbox control in grid view.
 
So please help me to solve out this problem

<asp:GridView ID="grFees" runat="server" CssClass="label " AutoGenerateColumns="False"
                                        OnRowCommand="grFees_RowCommand" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
                                        OnRowEditing="grFees_RowEditing" OnRowDeleting="grFees_RowDeleting" CellPadding="3"
                                        ForeColor="Black" GridLines="None" Font-Names="verdana" Font-Size="11px" AllowPaging="true"
                                        OnPageIndexChanging="grFees_PageIndexChanging" 
                                        onrowupdating="grFees_RowUpdating">
                                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                        <RowStyle Height="20px" BackColor="#F7F6F3" ForeColor="#333333" />
                                        <Columns>
                                            <asp:BoundField DataField="ParticularName" HeaderText="Particular Name">
                                                <HeaderStyle BackColor="#9097A9" HorizontalAlign="Left" VerticalAlign="Middle" Width="150px" />
                                                <ItemStyle HorizontalAlign="Left" VerticalAlign="Middle" Wrap="false" />
                                            </asp:BoundField>
Posted 17-Jan-13 18:21pm
Edited 17-Jan-13 18:34pm
v2
Comments
Sumit_Kumar_Sinha at 18-Jan-13 0:30am
   
post the complete design of girdview
viralchauhan at 18-Jan-13 0:34am
   
I have posted the gridview design
Sumit_Kumar_Sinha at 18-Jan-13 0:51am
   
Instead of asp:BoundField you use a <asp:TemplateField>............i think when we are using <asp:BoundField> then it's by default create
with textbox.................the best way for using gridview you can use <asp:TemplateField>..............
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you want that on edit button your grid will not show text boxes.
the use
protected void grFees_RowCommand(object sender, GridViewCommandEventArgs e)
{

if (e.CommandName.Equals("Edit"))
{
// your code.
}
}

Remove following

OnRowEditing="grFees_RowEditing" from your grid view.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

the gridviewe templatefield you need to design in the edititemtemplate

the the controls which will contains the data tha can be afected when using update or delete command
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 700
1 jyo.net 494
2 Sergey Alexandrovich Kryukov 449
3 Afzaal Ahmad Zeeshan 444
4 CPallini 426
0 OriginalGriff 1,065
1 Sergey Alexandrovich Kryukov 703
2 Afzaal Ahmad Zeeshan 702
3 DamithSL 681
4 CPallini 595


Advertise | Privacy | Mobile
Web01 | 2.8.150731.1 | Last Updated 28 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100