Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This Edits, Cancels and Updates:
VB
<asp:GridView ID="GridView1"
        runat="server"
        DataKeyNames="id"
        AutoGenerateEditButton="True"
        AutoGenerateDeleteButton="True"
        OnRowCancelingEdit="Gridview1_OnRowCancelingEdit"
        OnRowEditing="Gridview1_OnRowEditing" 
        OnRowUpdating="GridView1_OnRowUpdating
        />


This limits page size to 50 and has tabs for the rest:
VB
<asp:GridView ID="GridView1"
   runat="server"
   AllowPaging="True"
   PageSize="50"
   />


This sorts by ascending and descending just click to column label:
VB
<asp:GridView ID="GridView1"
   runat="server"
   DataSourceID="postData"
   AllowSorting="True"/>



What does this do? What do you need to run in conjunction with?
XML
<asp:GridView ID="gvRowCommand" runat=&uot;server"
    OnRowCommand="gvRowCommand_RowCommand">
    </asp:GridView>



What does this do? What do you need to run in conjunction with?
XML
<asp:GridView ID="GridView1" runat="server"
    OnSelectedIndexChanging="GridView1_SelectedIndexChanging">
    </asp:GridView>
Posted

1 solution

Answer for First Question

From MSDN :
Quote:
Occurs when a button is clicked in a GridView control
(Means fires when any of the Buttons like Edit, Cancel,Update etc.)

And to know which ButtonClick has triggered the event, need to set the CommandName for the Button and check inside the Event.

EX:

if(e.CommandName=="Edit")
{
//Code For Edit.

}

Second :

Quote:
Occurs when a row's Select button is clicked, but after the GridView control handles the select operation.


Its useful when need to retrieve the Gridview Selected Row value with the selectedIndex.

Refer MSDN

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand(v=vs.110).aspx[^]

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.selectedindexchanged(v=vs.110).aspx[^]

And follow some examples.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900