locked
ASP.net JavaScript Event RRS feed

  • Question

  • User102064424 posted

    i have a problem in my asp.net program. I have a function onDBLClick which is in JavaScript. The Grid from this function is in ModalPopupExtender. But the function dosn't work.

             <asp:Panel ID="PanelSearchColor" runat="server" Width="750" Height ="" Style="border: solid; border-width: 4px; border-color: black; background-color: #FFFFFF;"
                            AutoGenerateColumns="False" EnableRecordHover="True"">
               
                <cc2:Grid ID="gridFoundColors" runat="server" AllowAddingRecords="False" AllowMultiRecordSelection="False" AllowColumnReordering="True" AllowColumnResizing="True"
                            AutoGenerateColumns="False" EnableRecordHover="True" FolderStyle="App_Themes/GRID/black_glass" PageSize="26"
                            ShowGroupsInfo="True" ShowTotalNumberOfPages="True"  AllowMultiRecordEditing="False">
                            <LocalizationSettings 
                                Grouping_GroupingAreaText="<%$Resources:Grid, gridGroupingAreaText %>"
                                LoadingText="<%$Resources:Grid, gridLoadingText %>" 
                                NoRecordsText="<%$Resources:Grid, gridNoRecordsText %>" 
                                Paging_PageSizeText="<%$Resources:Grid, gridPageSizeText %>"
                                Paging_PagesText="<%$Resources:Grid, gridPagesText %>" 
                                Paging_RecordsText="<%$Resources:Grid, gridRecordsText %> " 
                                Paging_TotalNumberOfPages="<%$Resources:Grid, gridTotalNumberOfPages %>"
                                Paging_OfText="<%$Resources:Grid, gridOfText %>" 
                                Paging_ToText="<%$Resources:Grid, gridToText %>" />
                            <ClientSideEvents OnClientDblClick="onDBLClick" />
                            <Columns>
                                <cc2:Column DataField="PE_NR" HeaderText="PE NR" Index="0" Visible="False">
                                </cc2:Column>
                                <cc2:Column DataField="KATALOG_NR" HeaderText="KATALOG_NR" Index="1" Width="375">
                                </cc2:Column>
                                <cc2:Column DataField="VERTRETER_NR" HeaderText="VERTRETER_NR" Index="2" Width="375">
                                </cc2:Column>
                            </Columns>                                
                </cc2:Grid>
    
                 <script type="text/javascript">		
                     function onDBLClick(iRecordIndex)
                     {
                         var AuftragsID = PanelSearchColor.gridFoundColors.Rows[iRecordIndex].Cells[0].Value;
                         var urlString = "Auftragserfassung.aspx?OpenID=";
                         var target = urlString.concat(AuftragsID);
                         window.alert(target);
                         window.location(target);
                         window.open(target);
                    }
                </script>
                 
                 <asp:Button ID="DummyBTN23" runat="server"
                                Height="" meta:resourcekey="DummyBTN23" Text="<%$Resources:MusterglasFarbe, DummyBTN23 %>" Width="" />
            </asp:Panel>

    Wednesday, September 23, 2015 8:08 AM

All replies

  • User61956409 posted

    Hi KevinH95,

    Welcome to ASP.NET forum.

    Firstly, according to your code, you are not using ASP.NET built-in GridView control. When will OnClientDblClick fire? Does it fire When we click gird or row or column?

    Secondly, please debug your code to check if function onDBLClick(iRecordIndex) could be called.

    Thirdly, whether you could bind javascript click event for element via coding manually instead of setting OnClientDblClick property.

    Best Regards,

    Fei Han

    Wednesday, September 23, 2015 9:58 PM
  • User102064424 posted

    Hi,

    Firstly, it fire when double click on a Row in the Grid.

    Secondly, it is on the html site. So i cant debug it. The function will called in FireBug.

    Thirdly, i have bind a JavaScript event. This dosnt work.

    Thursday, September 24, 2015 8:09 AM
  • User61956409 posted

    Hi KevinH95,

    Secondly, it is on the html site. So i cant debug it. The function will called in FireBug.

    Could you show us html markup in the browser?

    Thirdly, i have bind a JavaScript event. This dosnt work.

    Besides, how do you bind javascript event? Please share us your relevant code.

    Best Regards,

    Fei Han

    Friday, September 25, 2015 3:43 AM
  • User102064424 posted

    i have find a method to debug the code.

    He cant find the Grid. I try also getElementById. It dosn't work.

    The code where i bind the javascript event is in my first post.

    <ClientSideEvents OnClientDblClick="onDBLClick" />
                            <Columns>
                                <cc2:Column DataField="PE_NR" HeaderText="PE NR" Index="0" Visible="False">
                                </cc2:Column>
                                <cc2:Column DataField="KATALOG_NR" HeaderText="KATALOG_NR" Index="1" Width="375">
                                </cc2:Column>
                                <cc2:Column DataField="VERTRETER_NR" HeaderText="VERTRETER_NR" Index="2" Width="375">
                                </cc2:Column>
                            </Columns>                                
                </cc2:Grid>
    
                 <script type="text/javascript">		
                     function onDBLClick(iRecordIndex)
                     {
    ...

    Friday, September 25, 2015 3:54 AM