Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a grid view and in this grid view, after click on button the Gridview_RowCommand is called

But My problem is I want to fill a text box,
after Button click and Before Gridview_RowCommand,
and if user Blank the text box then Gridview_RowCommand is not called,


because i want to use that text box value in gridview row command,


what I do so far is:

i call a ajax_popupextender on button click,

but before opening the ajax_popupextender all Gridview_RowCommand Code is Excuted,

so what can i do ?????

And Plz Don't advice that I write the code on ajax_popupextender button click,

Because For Many condition I Call the same ajax_popupextender,


My Code is:
Pop Is:

XML
<asp:Button runat="server" ID="FakeButton10" Text="hi" Style="display: none" />
           <asp:Panel ID="FlagIt" runat="server">

                   <div class="topBottom">
                       <table>

                           <tr>
                               <td>
                                   <asp:Label ID="lblstar" Font-Bold="true" Font-Size="20px" ForeColor="Red" runat="server"
                                       Text="*"></asp:Label>
                                   Add Description
                               </td>
                           </tr>
                           <tr>
                               <td>
                                   <asp:TextBox ID="txtDescri" CssClass="txtFinal" Height="70px" Width="200px" TextMode="MultiLine"
                                       runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator5"
                                           runat="server" Font-Bold="true" ForeColor="Red" ControlToValidate="txtDescri"
                                           ValidationGroup="flag" ErrorMessage="***"></asp:RequiredFieldValidator>
                               </td>
                           </tr>
                           <tr>
                               <td>
                                   <asp:Button ID="BtnSubmit" runat="server" CssClass="btndesign" ValidationGroup="flag"
                                       Text="Submit" OnClick="BtnSubmit_Click"  />
                               </td>
                           </tr>
                       </table>
                   </div>

           </asp:Panel>
           <asp:ModalPopupExtender PopupControlID="FlagIt" runat="server" ID="flagitshow" TargetControlID="FakeButton10"
               CancelControlID="ImgflagClose" BackgroundCssClass="modalPopupCss" BehaviorID="flagitshow">
           </asp:ModalPopupExtender>




Row Coommnad Code is:

C#
protected void gd_cat_RowCommand(object sender, GridViewCommandEventArgs e)
  {
      if (e.CommandName == "View_Profile")
      {

          flagitshow.Show();



          tbl_admin_myActivity m1 = new tbl_admin_myActivity();
          m1.T_id = Convert.ToInt32(Session["T_id"]);
          m1.date = DateTime.Now;
          m1.resion = txtDescri.Text;

          li.tbl_admin_myActivities.InsertOnSubmit(m1);
          li.SubmitChanges();
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900