[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet

Re: Change gridview from Update to Normal mode - Solution Example -

Re: Change gridview from Update to Normal mode - Solution Example -

Chamith Gamage

9/11/2011 8:04:00 AM

// Data bind to the grid after update in RowUpdating event.

The use the following method.

GridView1.SetEditRow(-1);

This worked for me.

> On Sunday, August 05, 2007 11:40 PM pvong wrote:

> VB.NET
>
> How do you change a gridview from Update mode to normal mode? I am usually
> dealing for Formviews and there is a ChangeMode option but I do not see one
> for Gridviews.


>> On Monday, August 06, 2007 1:36 AM ManishBafn wrote:

>> Hi,
>> An important property that plays a special role in Update and Delete
>> operations is the DataKeyNames property. This property is typically set to
>> the names of fields from the data source that are part of a primary key used
>> to match a given row in the data source. Multiple keys are comma-separated
>> when specifying this property declaratively, although it is common to only
>> have one primary key field. The values of fields specified by the
>> DataKeyNames property are round-tripped in viewstate for the sake of
>> retaining original values to pass to an Update or Delete operation, even if
>> that field is not rendered as one of the columns in the GridView control.
>> When the GridView invokes the data source Update or Delete operation, it
>> passes the values of these fields to the data source in a special Keys
>> dictionary, separate from the Values dictionary that contains new values
>> entered by the user while the row is in edit mode (for update operations).
>> The contents of the Values dictionary are obtained from the input controls
>> rendered for the row in edit mode. To exclude a value from this dictionary,
>> set the ReadOnly property to true on the corresponding BoundField in the
>> Column collection. If you are using the GridView designer in Visual Studio,
>> the ReadOnly property is set to true for primary key fields by default.
>> ref:http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gri...
>> --
>> Hope this helps.
>> Thanks and Regards.
>> Manish Bafna.
>> MCP and MCTS.
>>
>>
>>
>> "pvong" wrote:


>>> On Monday, August 06, 2007 9:29 AM pvong wrote:

>>> I read this, but I am still confused. I understand the concept of how it
>>> happens, but I do not understand how to make it happen.


>>>> On Monday, August 06, 2007 11:21 PM pvong wrote:

>>>> Please help me. This is the only missing step for me.
>>>>
>>>> Simple Gridview that when I hit Edit, I get Textboxes for editing. I have
>>>> inserted my own ADO.NET for the Update button and it works perfectly. I
>>>> just want the gridview to go back to normal view after it has updated. So
>>>> after Update, turn gridview back to original format where the textboxes are
>>>> labels again and you have the option to hit Edit again.
>>>>
>>>>
>>>>
>>>> "pvong" <phillip*at*yahoo*dot*com> wrote in message
>>>> news:O6qD3s91HHA.1212@TK2MSFTNGP05.phx.gbl...


>>>>> On Wednesday, March 04, 2009 6:07 PM imcortez imcortez wrote:

>>>>> Protected Sub gv_configuracion_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles gv_configuracion.RowUpdating
>>>>>
>>>>> 'ActualizaPorSistema is a Sub when Call a SP
>>>>>
>>>>> ActualizaPorSIstema()
>>>>>
>>>>> gv_configuracion.EditIndex = -1
>>>>>
>>>>> gv_configuracion.DataBind()
>>>>>
>>>>> 'Update my Code from sqldatasource
>>>>>
>>>>> SqlDataSource1.UpdateCommand = "update tblsetup set SETP_NAME = @SETP_NAME WHERE 1=2"
>>>>>
>>>>> SqlDataSource1.UpdateCommandType = SqlDataSourceCommandType.Text
>>>>>
>>>>> End Sub




Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Change gridview from Update to Normal mode - Solution Example -

Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te

Il servizio è completamente GRATUITO!