2010-12-13 18 views
1

こんにちは私は2つのpopupcontrolエクステンダに問題があります。これらは、データベースからの詳細情報を表示するためにWebサービスと組み合わせて使用​​されます。各エクステンダは、2つの異なるテーブルから情報aを取得します。エクステンダーは、同じ主キー番号を持つ行を渡って実行した場合を除いて、正常に動作します。同じIDを持つ2つのコンポーネントをアプリケーションに追加することはできません

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

によってレンダリングされる方法です後ろ

<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> 

**コード:ここでのコードは(私は情報のほとんどを削除)うまくいけばより速くビューにそれを作るためには何かということです

<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;" /> 

答えて

1

@マイク:それは、変数内の前の行のPkey値を格納することができますならば、私はこのような何かしたい -

Dim MyPkey As Integer = e.Row.DataItem("Pkey") 
Dim MyStoredPkey As Integer 

If MyPkey <> MyStoredPkey Then 
    MyStoredPkey = MyPkey 
Else 
    MyPkey = MyPkey + 1 
End If 

pceGVU.BehaviorID = MyPkey 

...格納変数にはPkeyをインクリメントする必要があります。

注::これはASP.NETの経験がほとんどないため、実質的には擬似コードです。

+0

Pkeyの値はテーブルの主キーであるため変更できません。情報を取得するためにWebサービスに渡す値です。 – Mike

+0

@Mike:そうです。申し訳ありませんが、私は助けなかった。私はより多くのASP.NET経験を持つ人があなたの質問に答えることを願っています。 – stealthyninja

+0

お試しいただきありがとうございます。 – Mike

関連する問題