Hi Olivier,
Thanks for your response. Glad that you've made some progress. As for the
using Response.Write to output some client script for setting focus, would
you provide some further description on this or the complete code snippet
that can demonstrate the behavior you mentioned? BTW, in ASP.NET 2.0 , the
Page class has the "SetFocus" method which can accept a control instance or
clientID as paramter so that the page will register the proper client
script for us, does this function meet your requirement or there is any
further concerns in your case? Please feel free to let me know.
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.)
--------------------
| From: "Olivier Matrot" <
[email protected]>
| References: <
[email protected]>
<d#
[email protected]>
<
[email protected]>
| Subject: Re: ASP.NET 1.1 Converted Projet : Datagrid problem
| Date: Fri, 4 Nov 2005 11:12:09 +0100
| Lines: 154
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| X-RFC2646: Format=Flowed; Response
| Message-ID: <
[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| NNTP-Posting-Host: reverse.completel.net 213.30.138.178
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet.datagridcontrol:5916
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
|
| Steven,
|
| I have found the problem modifying your sample to reach the same
| functionnality in my project. My fault.
|
| I'm using the event "ItemCreated" to set the focus to the first edit
| control. This is done sending the corresponding javascript code with
| Respone.Write().
|
| This breaks the Postback generated code.
| How can I automatically set the focus to the control with an alternate
| method ?
| TIA.
|
| | > Hi Steven,
| >
| > After looking at your sample, here are my comments :
| > 1) I'm not using an AutogeneratedColumns datagrid.
| > 2) Bound columns are converted into templates to be customized.
| > 3) I'm not using the ItemCommand Event Handler.
| >
| > I 'll try to reproduce the problem with your page.
| > In the meantime, here are some additonnal informations :
| >
| > Here is the datagrid tag :
| > <asp:datagrid id="dgReceivedHistory" runat="server" Font-Names="Arial"
| > Font-Size="8pt" AllowSorting="True"
| > GridLines="None" AllowPaging="True"
AutoGenerateColumns="False"
| > CellPadding="5" BorderStyle="None" PageSize="15"
| > Height="10px" meta:resourcekey="dgReceivedHistoryResource1">
| >
| > Here is te converted datagrid template column :
| >
| > <asp:TemplateColumn SortExpression="Edit">
| > <HeaderStyle Wrap="False"></HeaderStyle>
| > <ItemStyle Wrap="False"></ItemStyle>
| > <ItemTemplate>
| > <asp:ImageButton id="ibModify" runat="server"
| > ImageUrl="img/modify.gif" CommandName="Edit" ToolTip="Modifier l'objet"
| > CausesValidation="False"
| > meta:resourcekey="ibModifyResource1"></asp:ImageButton>
| > </ItemTemplate>
| > <FooterStyle Wrap="False"></FooterStyle>
| > <EditItemTemplate>
| > <asp:LinkButton onkeypress="if((event.which &&
event.which
| > == 13) || (event.keyCode && event.keyCode == 13))
| > {ClickButton(event,'lbtnSubmit');return(false);}"
| > id="lbValidate" runat="server" Text="Valider"
| > CommandName="Update"
| > meta:resourcekey="lbValidateResource1"></asp:LinkButton>
| > <asp:LinkButton id="lbCancel" runat="server"
Text="Annuler"
| > CommandName="Cancel" CausesValidation="False"
| > meta:resourcekey="lbCancelResource1"></asp:LinkButton>
| > </EditItemTemplate>
| > </asp:TemplateColumn>
| >
| > In the class file, here is the content of InitializeComponent() :
| > ....
| > this.dgReceivedHistory.CancelCommand += new
| >
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgReceivedHistory
_CancelCommand);
| > this.dgReceivedHistory.EditCommand += new
| >
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgReceivedHistory
_EditCommand);
| > this.dgReceivedHistory.UpdateCommand += new
| >
System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgReceivedHistory
_UpdateCommand);
| >
| > And the associated Edit function :
| > private void dgReceivedHistory_EditCommand(object source,
| > System.Web.UI.WebControls.DataGridCommandEventArgs e)
| > {
| > ....
| > dgReceivedHistory.EditItemIndex = e.Item.ItemIndex;
| > ....
| > }
| >
| > TIA.
| >
| > | >> Hi Olivier,
| >>
| >> Welcome to ASPNET newsgroup.
| >> From your description you have upgrated an ASP.NET 1.X web application
to
| >> ASP.NET 2.0 through VS.NET 2005 's upgrate wizard. After that, one page
| >> which contains DataGrid control dosn't work correctly on the
| >> Update/Cancel
| >> command event ,yes?
| >>
| >> Based on my local test, I upgrade a simple DataGrid Page which use
| >> Autogenerate column and an edit column, after converting to asp.net
2.0,
| >> the Edit/Update/Cancel event still works as expected. So I'm thinking
| >> this
| >> is likely a page specific problem. If convenient, would you please
| >> provide
| >> me a simple reproduce page (asp.net 1.x version) so that I can try
| >> converting and test on my side? Also, I've attached my test page in
this
| >> message, you can also have a reference if you feel necessary).
| >>
| >> If there're anything else we can help, please feel free to post here.
| >>
| >> Regards,
| >>
| >> 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: "Olivier Matrot" <
[email protected]>
| >> | Subject: ASP.NET 1.1 Converted Projet : Datagrid problem
| >> | Date: Thu, 3 Nov 2005 17:10:18 +0100
| >> | Lines: 17
| >> | X-Priority: 3
| >> | X-MSMail-Priority: Normal
| >> | X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
| >> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
| >> | X-RFC2646: Format=Flowed; Original
| >> | Message-ID: <
[email protected]>
| >> | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| >> | NNTP-Posting-Host: reverse.completel.net 213.30.138.178
| >> | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP09.phx.gbl
| >> | Xref: TK2MSFTNGXA01.phx.gbl
| >> microsoft.public.dotnet.framework.aspnet.datagridcontrol:5906
| >> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
| >> |
| >> | Hello,
| >> | I've converted an existing ASP.NET 1.1 project to Visual Studio 2005.
| >> | There is a problem with the Datagrid control. The Update & Cancel
| >> commands
| >> | are not working anymore (Edit is working).
| >> |
| >> | Ive noticed that the postback generated javascript has changed since
| >> | ASP.NET 1.1. For Example in ASP.NET 1.1, the Updade shortcut
| >> | is "javascript:__doPostBack('dgReceivedHistory$_ctl3$lbValidate','')"
| >> | In 2.0 it is now "javascript:__doPostBack('lbValidate','')".
| >> | The main differences is that there is no more reference to the
datagrid
| >> in
| >> | the client ID of the control...
| >> |
| >> | Any help apreciated.
| >> | TIA.
| >> |
| >> |
| >> |
| >> |
| >
| >
|
|
|