2017-06-10 7 views
0

グリッドビューの編集にモーダルポップアップを使用しています。グリッドビューは、別のグリッドビューの子グリッドビューです。私は、データベースへの送信時にテキストボックスの先頭にコンマを追加する問題のために、更新パネルからモーダルポップアップを移動しました。モデムポップアップを更新パネルから移動する前に、テキストボックスにデータが入力されていましたが、グリッドビューの更新パネルには表示されないため、テキストボックスにはgridviewデータが設定されません。いずれかの提案がありますか?ModalPopupExtenderテキストボックスに子グリッドビューのデータが設定されていません

<asp:UpdatePanel ID="UpdatePanel1" runat="server"> 
    <ContentTemplate> 

    <div style="background-color:white;text-align:center; padding:10px;border-radius:15px;box-shadow:5px 10px 15px #303A4C;margin-left:auto;margin-right:auto; max-width:100%;min-width:30%;float:left;"> 
    <h2 class="h2title"> 

    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" style="float:left;margin-left:10px;"> 
     <asp:ListItem Value="0">--Select--</asp:ListItem> 
     <asp:ListItem Value="1">Options</asp:ListItem> 
     <asp:ListItem Value="2">Parts</asp:ListItem> 
     <asp:ListItem Value="3">Bid Rates</asp:ListItem> 
    </asp:DropDownList> 
    Purchasing Approval</h2> 

    <asp:Panel ID="panel1" runat="server" Visible="false" Width="100%"> 
    <div class="griddiv" style="overflow-y:scroll;max-height:500px; max-width:80%;"> 

    <asp:GridView ID="GridView1" runat="server" Font-Size="Medium" CellPadding="5" GridLines="None" AutoGenerateColumns="False" 
         RowStyle-CssClass="rows" HeaderStyle-CssClass="gridheader" DataKeyNames="batchID" OnRowDataBound="OnRowDataBound" > 

          <Columns> 
           <asp:TemplateField> 
           <ItemTemplate> 
            <img alt = "" style="cursor: pointer" src="../img/plus.png" /> 
            <asp:Panel ID="childpanel" runat="server" Style="display: none;"> 
            <div class="griddiv" style="overflow-y:scroll;max-height:500px; max-width:80%;"> 
             <asp:GridView ID="gvchild" runat="server" Font-Size="Medium" CellPadding="5" GridLines="None" AutoGenerateColumns="False" 
                 CssClass="datagrid1" RowStyle-CssClass="rows" HeaderStyle-CssClass="gridheader" DataKeyNames="id"> 
              <Columns> 
              <asp:TemplateField ItemStyle-Width = "30px" HeaderText = ""> 
               <ItemTemplate> 
                <asp:LinkButton ID="lnkEdit" runat="server" Text = "Edit" OnClick = "Edit"></asp:LinkButton> 
               </ItemTemplate> 
              </asp:TemplateField> 
              <asp:TemplateField HeaderText="Option Number"> 
               <ItemTemplate> 
                 <asp:Label ID="optionnumtemp" runat="server" Text='<%#Eval("optionnum") %>'></asp:Label> 
                </ItemTemplate> 
               </asp:TemplateField> 
               <asp:BoundField ItemStyle-Width="150px" DataField="id" HeaderText="ID" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="optionnum" HeaderText="Option Number" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="optiondesc" HeaderText="Option Description" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="optioncat" HeaderText="Option Category" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="houseplan" HeaderText="House Plan" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="craftcode" HeaderText="Craft Code" /> 
               <asp:BoundField ItemStyle-Width="150px" DataField="parentoption" HeaderText="Parent Option" /> 
               <asp:TemplateField> 
               <HeaderTemplate> 
                 <asp:CheckBox runat="server" ID="chkHeader" TextAlign="Right"/> 
               </HeaderTemplate> 
               </asp:TemplateField> 
               <asp:TemplateField> 
                <ItemTemplate> 
                 <asp:CheckBox runat="server" ID="chkRow"/> 
                </ItemTemplate> 
               </asp:TemplateField> 
              </Columns> 
             </asp:GridView> 
             </div> 

            </asp:Panel> 

           </ItemTemplate> 
          </asp:TemplateField> 
           <asp:BoundField DataField = "batchID" HeaderText = "Batch ID" HtmlEncode = "true" HeaderStyle-Width="25%" /> 
           <asp:BoundField DataField = "requestdate" HeaderText = "Request Date" HtmlEncode = "true" HeaderStyle-Width="25%" /> 
           <asp:BoundField DataField = "requestby" HeaderText = "Requested By" HtmlEncode = "true" HeaderStyle-Width="25%"/> 
           <asp:BoundField DataField = "entityname" HeaderText = "Division" HtmlEncode = "true" HeaderStyle-Width="25%"/> 

          </Columns> 

         </asp:GridView> 
         <div class="button"> 
              <asp:Button ID="Button" runat="server" Text="Complete" /> 
             </div> 
         </div> 
         </asp:Panel> 
</ContentTemplate> 
     <Triggers> 
      <asp:AsyncPostBackTrigger ControlID = "GridView1" /> 
      <asp:AsyncPostBackTrigger ControlID = "btnSave" /> 
      </Triggers> 
     </asp:UpdatePanel> 
     <asp:Panel ID="pnlAddEdit" runat="server" CssClass="modalPopup" style = "display:none"> 
           <asp:Label Font-Bold = "true" ID = "Label4" runat = "server" Text = "Option Request" ></asp:Label> 
           <br /> 
           <table align = "center"> 
           <tr> 
           <td> 
           <asp:Label ID="rowid" runat="server" Text = "ID"></asp:Label> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label1" runat = "server" Text = "Option Number" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="optionnumtxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label2" runat = "server" Text = "Option Description" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="optiondesctxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label3" runat = "server" Text = "Option Category" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="optcattxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label5" runat = "server" Text = "House Plan" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="houseplantxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label6" runat = "server" Text = "Craft Code" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="craftcodetxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Label ID = "Label7" runat = "server" Text = "Parent Option" ></asp:Label> 
           </td> 
           <td> 
           <asp:TextBox ID="parentoptiontxt" runat="server"></asp:TextBox> 
           </td> 
           </tr> 
           <tr> 
           <td> 
           <asp:Button ID="btnSave" runat="server" Text="Save" OnClick = "Save" /> 
           </td> 
           <td> 
           <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClientClick = "return Hidepopup()"/> 
           </td> 
           </tr> 
           </table> 
           </asp:Panel> 
           <asp:LinkButton ID="lnkFake" runat="server"></asp:LinkButton> 
           <ajax:ModalPopupExtender ID="popup" runat="server" DropShadow="false" 
            PopupControlID="pnlAddEdit" TargetControlID = "lnkFake" 
            BackgroundCssClass="modalBackground"> 
           </ajax:ModalPopupExtender> 

保護されたサブ編集(オブジェクトとしてByVal送信者、EventArgsのとしてByVal e)の無応答でしばらく

For Each gvrow As GridViewRow In GridView1.Rows 
    Dim gvchild As GridView = TryCast(gvrow.FindControl("gvchild"), GridView) 
    Dim row As GridViewRow = CType(CType(sender, LinkButton).Parent.Parent, GridViewRow) 

    rowid.Text = row.Cells(1).Text 
    optionnumtxt.Text = row.Cells(2).Text 
    optiondesctxt.Text = row.Cells(3).Text 
    optcattxt.Text = row.Cells(4).Text 
    houseplantxt.Text = row.Cells(5).Text 
    craftcodetxt.Text = row.Cells(6).Text 
    parentoptiontxt.Text = row.Cells(7).Text 
    popup.Show() 

Next 

End Subの

答えて

0

は、私がこれまでハッキングを把握しようとしましたそれは私の状況のた​​めに働くでしょう。

parentoption = parentoption.Split(",").Last() 

提出されたテキストだけが入力された新しいテキストであるように、これはカンマを先行カンマと何かを削除します。

関連する問題