I would like to set the focus to a particular control when opening the RowEditTemplate on a WebDataGrid. Can you share some code that accomplishes this?
Thanks, Dave
Hello davefevold,
You can handle TemplateOpened event and to set the focus of the control you want. The following code will set focus to the second WebNumericEditor2 from the RowEditingTemplate
<script type="text/javascript"> var editor; function WebDataGrid1_TemplateOpened(sender, eventArgs) { editor.setFocus(); } function WebNumericEditor2_Initialize(sender, eventArgs) { editor = sender; } </script></head><body> <form id="form1" runat="server"> <div> <ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> <Columns> <ig:BoundDataField DataFieldName="CategoryID" Key="CategoryID"> <Header Text="CategoryID" /> </ig:BoundDataField> <ig:BoundDataField DataFieldName="CategoryName" Key="CategoryName"> <Header Text="CategoryName" /> </ig:BoundDataField> </Columns> <Behaviors> <ig:EditingCore> <Behaviors> <ig:RowEditingTemplate> <EditModeActions MouseClick="Double" /> <Template> <div style="background-color: Red; width: 250px; height: 250px"> <ig:WebNumericEditor ID="WebNumericEditor1" runat="server"> </ig:WebNumericEditor> <ig:WebNumericEditor ID="WebNumericEditor2" runat="server"> <ClientEvents Initialize="WebNumericEditor2_Initialize" /> </ig:WebNumericEditor> </div> </Template> <RowEditingClientEvents TemplateOpened="WebDataGrid1_TemplateOpened" /> </ig:RowEditingTemplate> </Behaviors> </ig:EditingCore> <ig:RowSelectors> </ig:RowSelectors> </Behaviors> </ig:WebDataGrid>
I hope this help
That works great...thx! Now, how do I get the rest of the screen to blur when the RowEditTemplate is opened. That is a nice effect.
There is no such built in functionality. This can be done with jQuery, there are a lot of plugins that you can use. You can put the code for this effect in WebDataGrid1_TemplateOpen, so the effect is loaded when the template is opened.