Здравствуйте, у меня проблемы с 2-мя расширителями popupcontrol.Они используются совместно с веб-сервисом для отображения подробной информации из базы данных.Каждый расширитель получает информацию из 2 разных таблиц.Оба расширителя работают нормально, за исключением случаев, когда они натолкнулись на строку с одинаковым номером первичного ключа.Вот что такое код (я удалил большую часть информации), чтобы, надеюсь, сделать его быстрее для просмотра:
<cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" CssClass="ajax__myTab" Width="100%" ScrollBars="Horizontal">
<cc1:TabPanel ID="TabPanel5" runat="server" HeaderText="" Enabled="true">
<HeaderTemplate>Agent Info </HeaderTemplate>
<ContentTemplate>
<asp:GridView ID="GridViewClosedProducts" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"
CellPadding="5" CellSpacing="1" DataKeyNames="Pkey"
DataSourceID="SqlDataSourceGRClosedProds" ForeColor="Black" GridLines="Vertical"
AllowSorting="True" PageSize="20">
<FooterStyle BackColor="#CCCCCC" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image runat="server" BorderStyle="None" ID="Image1" ImageUrl="Images\MagnifyingClass.gif" />
<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1" TargetControlID="Image1" DynamicContextKey='<%# Eval("Pkey") %>' DynamicControlID="Panel1" DynamicServiceMethod="GetClosedComment" Position="right">
</cc1:PopupControlExtender>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</ItemTemplate>
<HeaderStyle VerticalAlign="Top" BorderWidth="0px" />
<ItemStyle BorderWidth="0px" HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Silver" Font-Bold="True" ForeColor="Black" />
<AlternatingRowStyle BackColor="#CCCCCC" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourceGRClosedProds" runat="server"
ConnectionString="<%$ ConnectionStrings:EUCNET00722 %>"
SelectCommand="SELECT * FROM [tblClosedProducts] WHERE ([AgentMainPkey] = @AgentMainPkey) ORDER BY Product, DateClosed">
<SelectParameters>
<asp:ControlParameter ControlID="hdnPkey" Name="AgentMainPkey" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID="TabPanel3" runat="server" HeaderText="" Enabled="true">
<HeaderTemplate>Agent Info </HeaderTemplate>
<ContentTemplate>
<asp:GridView ID="GridViewUpdates" runat="server" AutoGenerateColumns="False" BackColor="White"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px" CellPadding="5"
CellSpacing="1" DataKeyNames="Pkey" DataSourceID="SqlDataSourceGRUpdates" ForeColor="Black"
GridLines="Vertical">
<AlternatingRowStyle BackColor="#CCCCCC" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:Image runat="server" BorderStyle="None" ID="Image1" ImageUrl="Images\MagnifyingClass.gif" />
<cc1:PopupControlExtender ID="PopupControlExtenderGVU" runat="server" PopupControlID="Panel1" TargetControlID="Image1" DynamicContextKey='<%# Eval("Pkey") %>' DynamicControlID="Panel1" DynamicServiceMethod="GetUpdateComment" Position="right">
</cc1:PopupControlExtender>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
</ItemTemplate>
<HeaderStyle VerticalAlign="Top" BorderWidth="0px" />
<ItemStyle BorderWidth="0px" HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Silver" Font-Bold="True" ForeColor="Black" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSourceGRUpdates" runat="server" ConnectionString="<%$ ConnectionStrings:EUCNET00722 %>" SelectCommand="SELECT * FROM [tblComments] WHERE ([AgentMainPkey] = @AgentMainPkey) ORDER BY DateOfComment DESC" DeleteCommand="delete from tblComments where pkey = @pkey">
<SelectParameters>
<asp:ControlParameter ControlID="hdnPkey" Name="AgentMainPkey" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
** Код позади
Protected Sub GridViewClosedProducts_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewClosedProducts.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If Not e.Row.DataItem Is Nothing Then
Dim pce As PopupControlExtender = TryCast(e.Row.FindControl("PopupControlExtender1"), PopupControlExtender)
Dim MyPkey As String = e.Row.DataItem("Pkey")
pce.BehaviorID = MyPkey
Dim img As Image = DirectCast(e.Row.FindControl("Image1"), Image)
Dim OnMouseOverScript As String = String.Format("$find('{0}').showPopup();", MyPkey)
Dim OnMouseOutScript As String = String.Format("$find('{0}').hidePopup();", MyPkey)
img.Attributes.Add("onmouseover", OnMouseOverScript)
img.Attributes.Add("onmouseout", OnMouseOutScript)
End If
End If
End Sub
Protected Sub GridViewUpdates_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridViewUpdates.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If Not e.Row.DataItem Is Nothing Then
Dim pceGVU As PopupControlExtender = TryCast(e.Row.FindControl("PopupControlExtenderGVU"), PopupControlExtender)
Dim MyPkey As String = e.Row.DataItem("Pkey")
pceGVU.BehaviorID = MyPkey
Dim img As Image = DirectCast(e.Row.FindControl("Image1"), Image)
Dim OnMouseOverScript As String = String.Format("$find('{0}').showPopup();", MyPkey)
Dim OnMouseOutScript As String = String.Format("$find('{0}').hidePopup();", MyPkey)
img.Attributes.Add("onmouseover", OnMouseOverScript)
img.Attributes.Add("onmouseout", OnMouseOutScript)
End If
End If
End Sub
Вот как кодпредоставлено IE
<img id="ctl00_ContentPlaceHolder2_TabContainer1_TabPanel5_GridViewClosedProducts_ctl10_Image1" onmouseover="$find('48').showPopup();" onmouseout="$find('48').hidePopup();" src="Images\MagnifyingClass.gif" style="border-style:None;border-width:0px;" />
<img id="ctl00_ContentPlaceHolder2_TabContainer1_TabPanel3_GridViewUpdates_ctl02_Image1" onmouseover="$find('48').showPopup();" onmouseout="$find('48').hidePopup();" src="Images\MagnifyingClass.gif" style="border-style:None;border-width:0px;" />