自动完成扩展程序不使用子网格视图

时间:2018-06-13 17:41:39

标签: c# asp.net autocomplete asp.net-ajax

具有两个网格视图child和parent的设计代码如下所示。

 <asp:GridView ID="gridDetail" runat="server" CssClass="Grid" AutoGenerateColumns="false"
                              Width="592px" OnRowDataBound="gridDetail_OnRowDataBound" DataKeyNames="Testname">
                <AlternatingRowStyle CssClass="AltItem" />
                <RowStyle CssClass="Item" />
                <EmptyDataTemplate>
                    <div class="emptystyle">
                        <b>No Record Found!!</b>
                    </div>
                </EmptyDataTemplate>
                <HeaderStyle CssClass="Header" />
                <Columns>



                <asp:TemplateField>
                <ItemTemplate>
                <img alt = "" style="cursor: pointer" src="../images/plus.png" />
                <asp:Panel ID="pnlOrders" runat="server" Style="display: none">
                <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false" CssClass = "ChildGrid">
                <Columns>

                    <asp:TemplateField>

                        <ItemTemplate>

                            <asp:TextBox ID="txtDrug" runat="server" AutoPostBack="true" CssClass="textboxStyle"
                                         onkeyup="SetContextKey()"  Width="200px"></asp:TextBox>

                            <div id="divwidth" runat="server">
                            </div>
                            <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" BehaviorID="autoComplete"
                                                      CompletionListCssClass="AutoCompleteFlyout" CompletionListElementID="divwidth" 
                                                      CompletionListHighlightedItemCssClass="AutoCompleteFlyoutHilightedItem" CompletionListItemCssClass="AutoCompleteFlyoutItem"
                                                      EnableCaching="true" MinimumPrefixLength="1" ServiceMethod="GetTestName" TargetControlID="txtDrug" FirstRowSelected="True" 
                                                      UseContextKey="true">
                            </asp:AutoCompleteExtender>


                        </ItemTemplate>
                    </asp:TemplateField>

                            <asp:TemplateField Visible="true" HeaderText="Content" HeaderStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:Label ID="txtcontent" runat="server" Text='<%#Eval("Content")%>'
                                               BackColor="Transparent"></asp:Label>
                                </ItemTemplate>
                                <ItemStyle Width="200px" />
                            </asp:TemplateField>

                            <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="txtPatientId" runat="server" Text='<%#Eval("PatientTestDetailID")%>'
                                        BackColor="Transparent"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="txtId" runat="server" Text='<%#Eval("TestID")%>' BackColor="Transparent"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField Visible="false">
                                <ItemTemplate>
                                    <asp:Label ID="txtPathologyId" runat="server" Text='<%#Eval("PathologyRegID")%>'
                                        BackColor="Transparent"></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>

                    <asp:TemplateField HeaderText="Test Range" HeaderStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:TextBox ID="txtname" runat="server"  BackColor="Transparent" Width="230px" Text='<%#Eval("Range")%>' onkeyup="SetContextKey()" ></asp:TextBox>



                        </ItemTemplate>
                    </asp:TemplateField>

...

Web服务方法如下所示,但它无法正常工作我已尝试在父网格中放置一个文本框和自动完成扩展程序。但是当我将它移到子网格中时,即使不调用Web服务方法也无法工作。

0 个答案:

没有答案