Groups | Blog | Home
all groups > asp.net datagrid control > december 2005 >

asp.net datagrid control : Call client script to update an item in a data grid


LehrSJ
12/30/2005 11:35:04 AM
Is there a way to run client script function or procedure to update data in a
data grid? Say I have a textbox in the datagrid. The user enters some data.
After exiting the textbox I'd like a client script to change the new value to
all upper case or if it's a date format it a certain way.

thanks
--
Eliyahu Goldin
1/1/2006 10:04:22 AM
Sure, you just need to setup client-side events. One way is to handle the
grid's ItemDataBound event. In the event you get access to the item (row)
elements and use their Attributes collection for adding client-side event
handlers.

Eliyahu

[quoted text, click to view]

stcheng NO[at]SPAM online.microsoft.com
1/3/2006 2:57:16 AM
Hi LehrSJ,

As Eliyahu has mentioned, we can use the DataGrid's ItemDataBound or
ItemCreated event to add the clientside script handler for the certain
controls in the DataGrid Column.... e.g:

Sub DataGrid_ItemCreated(Sender As Object, e As DataGridItemEventArgs)
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem,
ListItemType.EditItem
Dim myDeleteButton As Button
myDeleteButton = e.Item.FindControl("btnDelete")
myDeleteButton.Attributes.Add("onclick",_
"return confirm('Are you sure you want to delete this company?');")

End Select
End Sub

the above code programmatically add a confirm script for a button in a
datagrid template column....

Also, you can use predefined script functions in aspx page also......

Hope helps.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "Eliyahu Goldin" <removemeegoldin@monarchmed.com>
| References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
| Subject: Re: Call client script to update an item in a data grid
| Date: Sun, 1 Jan 2006 10:04:22 +0200
| Lines: 22
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| Message-ID: <Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: 212.143.94.3
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:14995
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Sure, you just need to setup client-side events. One way is to handle the
| grid's ItemDataBound event. In the event you get access to the item (row)
| elements and use their Attributes collection for adding client-side event
| handlers.
|
| Eliyahu
|
[quoted text, click to view]
| > Is there a way to run client script function or procedure to update
data
| > in a
| > data grid? Say I have a textbox in the datagrid. The user enters some
| > data.
| > After exiting the textbox I'd like a client script to change the new
value
| > to
| > all upper case or if it's a date format it a certain way.
| >
| > thanks
| > --
| > LehrSJ
|
|
|
LehrSJ
1/3/2006 6:51:03 AM
Thanks. Is it possible to do this with a GridView or DetailsView?
--
LehrSJ


[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
1/4/2006 3:30:23 AM
Of course GridView, DetailsView and most other template databound controls
can utilize such means.... Also, there is another method for injecting
clientside script for such inner controls:

We can declare a "PreRender" event handler for those controls (a
TextBox....), e.g:

==============
<EditItemTemplate>
id:
<asp:Label ID="idLabel1" runat="server" Text='<%#
Eval("id") %>'></asp:Label><br />
name:
<asp:TextBox ID="nameTextBox" runat="server" Text='<%#
Bind("name") %>' OnPreRender="TextBox_OnPreRender">
</asp:TextBox><br />
================

"TextBox_OnPreRender" is a non-private method defined in the Page's
codebehind class, and we put the script registering code in that
method......

Using this means can avoid intercepting the DataBound control's ItemCreated
or ItemDataBound event, only concencrate on the inner control we care
about....

Hope also helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Call client script to update an item in a data grid
| thread-index: AcYQdR5oMm/Eg1pxS16acJmte72Btw==
| X-WBNR-Posting-Host: 70.118.231.121
| From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
| References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
<Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
<fJbEvFBEGHA.3764@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Call client script to update an item in a data grid
| Date: Tue, 3 Jan 2006 06:51:03 -0800
| Lines: 84
| Message-ID: <D33BC714-6049-4433-9E09-1A50B0AA8666@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:15004
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Thanks. Is it possible to do this with a GridView or DetailsView?
| --
| LehrSJ
|
|
[quoted text, click to view]
|
| > Hi LehrSJ,
| >
| > As Eliyahu has mentioned, we can use the DataGrid's ItemDataBound or
| > ItemCreated event to add the clientside script handler for the certain
| > controls in the DataGrid Column.... e.g:
| >
| > Sub DataGrid_ItemCreated(Sender As Object, e As DataGridItemEventArgs)
| > Select Case e.Item.ItemType
| > Case ListItemType.Item, ListItemType.AlternatingItem,
| > ListItemType.EditItem
| > Dim myDeleteButton As Button
| > myDeleteButton = e.Item.FindControl("btnDelete")
| > myDeleteButton.Attributes.Add("onclick",_
| > "return confirm('Are you sure you want to delete this company?');")
| >
| > End Select
| > End Sub
| >
| > the above code programmatically add a confirm script for a button in a
| > datagrid template column....
| >
| > Also, you can use predefined script functions in aspx page also......
| >
| > Hope helps.
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| > --------------------
| > | From: "Eliyahu Goldin" <removemeegoldin@monarchmed.com>
| > | References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
| > | Subject: Re: Call client script to update an item in a data grid
| > | Date: Sun, 1 Jan 2006 10:04:22 +0200
| > | Lines: 22
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2527
| > | X-RFC2646: Format=Flowed; Original
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527
| > | Message-ID: <Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > | NNTP-Posting-Host: 212.143.94.3
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.datagridcontrol:14995
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > |
| > | Sure, you just need to setup client-side events. One way is to handle
the
| > | grid's ItemDataBound event. In the event you get access to the item
(row)
| > | elements and use their Attributes collection for adding client-side
event
| > | handlers.
| > |
| > | Eliyahu
| > |
[quoted text, click to view]
| > | > Is there a way to run client script function or procedure to update
| > data
| > | > in a
| > | > data grid? Say I have a textbox in the datagrid. The user enters
some
| > | > data.
| > | > After exiting the textbox I'd like a client script to change the
new
| > value
| > | > to
| > | > all upper case or if it's a date format it a certain way.
| > | >
| > | > thanks
| > | > --
| > | > LehrSJ
| > |
| > |
| > |
| >
| >
|
LehrSJ
1/7/2006 6:12:02 AM
Thanks for the information but I don't see what to do in the PreRender event
to add the attribute to the textbox for the client script to call. In the
edit template field the textbox name is EmpName. So my PreRender event looks
like:

Protected Sub EmpName_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs)

But there is no "e.item" option to refer to the item like the example you
had for the datagrid, DataGridItemEventArgs.
--
LehrSJ


[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
1/9/2006 8:14:55 AM
Thanks for your response LehrSJ,

Surely the TextBox's PreRender event won't contains the same event Argument
like DataGird's ItemDataBound or itemCreated, however, when we just need to
add some attributes which only related to the Textbox's own value(number
formatting or range validation scripts...), PreRender will be a good event
since it is only associated with the textbox we want to hook.... Also,
PreRendder event is the last event we can use to change controls' states
before rendering out(so the page's control structure should have been
construted well at that time...)

And if you want your registered script also depend on some info on the
DataGrid's bound data item or other cells' value, I think we have to use
ItemDataBound event ....

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| Thread-Topic: Call client script to update an item in a data grid
| thread-index: AcYTlFRiiNBKU6J8SzCuVoP2xTc+vQ==
| X-WBNR-Posting-Host: 70.118.231.121
| From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
| References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
<Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
<fJbEvFBEGHA.3764@TK2MSFTNGXA02.phx.gbl>
<D33BC714-6049-4433-9E09-1A50B0AA8666@microsoft.com>
<GGcg48NEGHA.1888@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Call client script to update an item in a data grid
| Date: Sat, 7 Jan 2006 06:12:02 -0800
| Lines: 173
| Message-ID: <394EAC90-EDDA-49C3-9F2C-12816299A9F2@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:15020
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Thanks for the information but I don't see what to do in the PreRender
event
| to add the attribute to the textbox for the client script to call. In
the
| edit template field the textbox name is EmpName. So my PreRender event
looks
| like:
|
| Protected Sub EmpName_PreRender(ByVal sender As Object, ByVal e As
| System.EventArgs)
|
| But there is no "e.item" option to refer to the item like the example you
| had for the datagrid, DataGridItemEventArgs.
| --
| LehrSJ
|
|
[quoted text, click to view]
|
| > Of course GridView, DetailsView and most other template databound
controls
| > can utilize such means.... Also, there is another method for
injecting
| > clientside script for such inner controls:
| >
| > We can declare a "PreRender" event handler for those controls (a
| > TextBox....), e.g:
| >
| > ==============
| > <EditItemTemplate>
| > id:
| > <asp:Label ID="idLabel1" runat="server" Text='<%#
| > Eval("id") %>'></asp:Label><br />
| > name:
| > <asp:TextBox ID="nameTextBox" runat="server" Text='<%#
| > Bind("name") %>' OnPreRender="TextBox_OnPreRender">
| > </asp:TextBox><br />
| > ================
| >
| > "TextBox_OnPreRender" is a non-private method defined in the Page's
| > codebehind class, and we put the script registering code in that
| > method......
| >
| > Using this means can avoid intercepting the DataBound control's
ItemCreated
| > or ItemDataBound event, only concencrate on the inner control we care
| > about....
| >
| > Hope also helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: Call client script to update an item in a data grid
| > | thread-index: AcYQdR5oMm/Eg1pxS16acJmte72Btw==
| > | X-WBNR-Posting-Host: 70.118.231.121
| > | From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
| > | References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
| > <Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
| > <fJbEvFBEGHA.3764@TK2MSFTNGXA02.phx.gbl>
| > | Subject: Re: Call client script to update an item in a data grid
| > | Date: Tue, 3 Jan 2006 06:51:03 -0800
| > | Lines: 84
| > | Message-ID: <D33BC714-6049-4433-9E09-1A50B0AA8666@microsoft.com>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path:
TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.datagridcontrol:15004
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > |
| > | Thanks. Is it possible to do this with a GridView or DetailsView?
| > | --
| > | LehrSJ
| > |
| > |
[quoted text, click to view]
| > |
| > | > Hi LehrSJ,
| > | >
| > | > As Eliyahu has mentioned, we can use the DataGrid's ItemDataBound
or
| > | > ItemCreated event to add the clientside script handler for the
certain
| > | > controls in the DataGrid Column.... e.g:
| > | >
| > | > Sub DataGrid_ItemCreated(Sender As Object, e As
DataGridItemEventArgs)
| > | > Select Case e.Item.ItemType
| > | > Case ListItemType.Item, ListItemType.AlternatingItem,
| > | > ListItemType.EditItem
| > | > Dim myDeleteButton As Button
| > | > myDeleteButton = e.Item.FindControl("btnDelete")
| > | > myDeleteButton.Attributes.Add("onclick",_
| > | > "return confirm('Are you sure you want to delete this
company?');")
| > | >
| > | > End Select
| > | > End Sub
| > | >
| > | > the above code programmatically add a confirm script for a button
in a
| > | > datagrid template column....
| > | >
| > | > Also, you can use predefined script functions in aspx page
also......
| > | >
| > | > Hope helps.
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | > --------------------
LehrSJ
1/10/2006 6:00:04 AM
I finally realized what I was doing wrong. I got it to work with the
ItemCreated event. My problem was that the textbox only exists when the
current mode is edit. I wasn't checking for this and was trying to add the
attribute when in readonly mode. So I got an error. It's working fine now.
Thanks.
--
LehrSJ


[quoted text, click to view]
stcheng NO[at]SPAM online.microsoft.com
1/10/2006 2:22:55 PM
Thanks for your followup.

Glad that you've got it working.

Have a good day!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Call client script to update an item in a data grid
| thread-index: AcYV7ife9MRNssIKRDOhSulEpS82aQ==
| X-WBNR-Posting-Host: 70.118.231.121
| From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
| References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
<Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
<fJbEvFBEGHA.3764@TK2MSFTNGXA02.phx.gbl>
<D33BC714-6049-4433-9E09-1A50B0AA8666@microsoft.com>
<GGcg48NEGHA.1888@TK2MSFTNGXA02.phx.gbl>
<394EAC90-EDDA-49C3-9F2C-12816299A9F2@microsoft.com>
<dAMVNTPFGHA.3680@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: Call client script to update an item in a data grid
| Date: Tue, 10 Jan 2006 06:00:04 -0800
| Lines: 266
| Message-ID: <6D119A35-8527-4A9F-B0B4-C7A6CE55DD4C@microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:15040
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| I finally realized what I was doing wrong. I got it to work with the
| ItemCreated event. My problem was that the textbox only exists when the
| current mode is edit. I wasn't checking for this and was trying to add
the
| attribute when in readonly mode. So I got an error. It's working fine
now.
| Thanks.
| --
| LehrSJ
|
|
[quoted text, click to view]
|
| > Thanks for your response LehrSJ,
| >
| > Surely the TextBox's PreRender event won't contains the same event
Argument
| > like DataGird's ItemDataBound or itemCreated, however, when we just
need to
| > add some attributes which only related to the Textbox's own
value(number
| > formatting or range validation scripts...), PreRender will be a good
event
| > since it is only associated with the textbox we want to hook....
Also,
| > PreRendder event is the last event we can use to change controls'
states
| > before rendering out(so the page's control structure should have been
| > construted well at that time...)
| >
| > And if you want your registered script also depend on some info on the
| > DataGrid's bound data item or other cells' value, I think we have to
use
| > ItemDataBound event ....
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | Thread-Topic: Call client script to update an item in a data grid
| > | thread-index: AcYTlFRiiNBKU6J8SzCuVoP2xTc+vQ==
| > | X-WBNR-Posting-Host: 70.118.231.121
| > | From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
| > | References: <FEBA6FEE-917A-4604-A780-45DFC22CBA2E@microsoft.com>
| > <Of12ioqDGHA.3828@TK2MSFTNGP14.phx.gbl>
| > <fJbEvFBEGHA.3764@TK2MSFTNGXA02.phx.gbl>
| > <D33BC714-6049-4433-9E09-1A50B0AA8666@microsoft.com>
| > <GGcg48NEGHA.1888@TK2MSFTNGXA02.phx.gbl>
| > | Subject: Re: Call client script to update an item in a data grid
| > | Date: Sat, 7 Jan 2006 06:12:02 -0800
| > | Lines: 173
| > | Message-ID: <394EAC90-EDDA-49C3-9F2C-12816299A9F2@microsoft.com>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet.datagridcontrol:15020
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| > |
| > | Thanks for the information but I don't see what to do in the
PreRender
| > event
| > | to add the attribute to the textbox for the client script to call.
In
| > the
| > | edit template field the textbox name is EmpName. So my PreRender
event
| > looks
| > | like:
| > |
| > | Protected Sub EmpName_PreRender(ByVal sender As Object, ByVal e As
| > | System.EventArgs)
| > |
| > | But there is no "e.item" option to refer to the item like the example
you
| > | had for the datagrid, DataGridItemEventArgs.
| > | --
| > | LehrSJ
| > |
| > |
[quoted text, click to view]
| > |
| > | > Of course GridView, DetailsView and most other template databound
| > controls
| > | > can utilize such means.... Also, there is another method for
| > injecting
| > | > clientside script for such inner controls:
| > | >
| > | > We can declare a "PreRender" event handler for those controls (a
| > | > TextBox....), e.g:
| > | >
| > | > ==============
| > | > <EditItemTemplate>
| > | > id:
| > | > <asp:Label ID="idLabel1" runat="server" Text='<%#
| > | > Eval("id") %>'></asp:Label><br />
| > | > name:
| > | > <asp:TextBox ID="nameTextBox" runat="server"
Text='<%#
| > | > Bind("name") %>' OnPreRender="TextBox_OnPreRender">
| > | > </asp:TextBox><br />
| > | > ================
| > | >
| > | > "TextBox_OnPreRender" is a non-private method defined in the Page's
| > | > codebehind class, and we put the script registering code in that
| > | > method......
| > | >
| > | > Using this means can avoid intercepting the DataBound control's
| > ItemCreated
| > | > or ItemDataBound event, only concencrate on the inner control we
care
| > | > about....
| > | >
| > | > Hope also helps. Thanks,
| > | >
| > | > Steven Cheng
| > | > Microsoft Online Support
| > | >
| > | > Get Secure! www.microsoft.com/security
| > | > (This posting is provided "AS IS", with no warranties, and confers
no
| > | > rights.)
| > | >
| > | >
| > | >
| > | > --------------------
| > | > | Thread-Topic: Call client script to update an item in a data grid
| > | > | thread-index: AcYQdR5oMm/Eg1pxS16acJmte72Btw==
| > | > | X-WBNR-Posting-Host: 70.118.231.121
| > | > | From: =?Utf-8?B?TGVoclNK?= <lehr524@noemail.nospam>
AddThis Social Bookmark Button