Click here to Skip to main content
15,916,215 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHow to disable gridview by checkbox? Pin
samflex4-Dec-17 7:56
samflex4-Dec-17 7:56 
Greetings again experts,

I have seven gridview controls, Gridview1 through Gridview7.

For now, I am posting below the code for two of the seven gridview controls.

PHP
<asp:gridview ID="Gridview1" gridlines="None" runat="server" ShowFooter="true" AutoGenerateColumns="false" onrowdatabound="Gridview1_RowDataBound" OnRowDeleting="Gridview1_RowDeleting">
  <Columns>
  <asp:BoundField DataField="RowNumber" Visible="false" HeaderText="Row Number" />
  <asp:TemplateField HeaderText="Name">
   <headerstyle horizontalalign="Left" />
      <ItemTemplate>
          <asp:TextBox ID="txtsourcename" placeholder="Name..." runat="server" style="width:250px;" class="form-control"></asp:TextBox>
      </ItemTemplate>
  </asp:TemplateField>
  <asp:TemplateField HeaderText="Address">
  <ItemStyle HorizontalAlign="Left"></ItemStyle>
      <ItemTemplate>
          <asp:TextBox ID="txtsourceaddress" placeholder="Address..." runat="server" style="width:250px;" class="form-control"></asp:TextBox>
      </ItemTemplate>
  </asp:TemplateField>
  <asp:TemplateField HeaderText="Income">
  <ItemStyle HorizontalAlign="Left"></ItemStyle>
      <ItemTemplate>
           <asp:TextBox ID="txtsourceincome" placeholder="Income...(example: 1000)" runat="server" style="width:250px;" class="form-control txtsourceincome numeric"></asp:TextBox>
      </ItemTemplate>
             </asp:TemplateField>
  <asp:TemplateField HeaderText="">
      <ItemTemplate>
       <asp:Button ID="ButtonAdd" runat="server" Text="Add"
              onclick="ButtonAdd_Click" CssClass="grvAddButton" OnClientClick="return ValidateEmptyValue();" />
      </ItemTemplate>
  </asp:TemplateField>
 <asp:CommandField ShowDeleteButton="True"><ControlStyle CssClass="grvDelButton" /></asp:CommandField>
  </Columns>
</asp:gridview>
  <span style="font-weight:bold;font-size:18px;color:#000000;">Name and address of income source of spouse greater than $1,000.00 (No comma (,)  or period(.); Example 1000)</span><br /><br />
  <asp:gridview ID="Gridview1" GridLines="None" runat="server" ShowFooter="true" AutoGenerateColumns="false" onrowdatabound="gGridview1_RowDataBound" OnRowDeleting="Gridview1_RowDeleting">
  <Columns>
  <asp:BoundField DataField="SpouseNumber" Visible="false" HeaderText="Row Number" />
  <asp:TemplateField HeaderText="Name">
  <headerstyle horizontalalign="Left" />
      <ItemTemplate>
          <asp:TextBox ID="txtspousename" placeholder="Name..." runat="server" style="width:250px;" class="form-control"></asp:TextBox>
      </ItemTemplate>
  </asp:TemplateField>
  <asp:TemplateField HeaderText="Address">
  <ItemStyle HorizontalAlign="Left"></ItemStyle>
      <ItemTemplate>
          <asp:TextBox ID="txtspouseaddress" placeholder="Address..." runat="server" style="width:250px;" class="form-control"></asp:TextBox>
      </ItemTemplate>
  </asp:TemplateField>
  <asp:TemplateField HeaderText="Income">
  <ItemStyle HorizontalAlign="Left"></ItemStyle>
      <ItemTemplate>
           <asp:TextBox ID="txtspouseincome" placeholder="Income...(example: 1000)" runat="server" style="width:250px;" class="form-control txtsourceincome numeric"></asp:TextBox>
      </ItemTemplate>
 </asp:TemplateField>
  <asp:TemplateField HeaderText="">
      <ItemTemplate>
       <asp:Button ID="ButtonAdd2" runat="server" Text="Add"
              onclick="ButtonAdd2_Click" CssClass="grvAddButton" OnClientClick="return ValidateSPEmptyValue();" />
      </ItemTemplate>
  </asp:TemplateField>
 <asp:CommandField ShowDeleteButton="True"><ControlStyle CssClass="grvDelButton" /></asp:CommandField>
  </Columns>
</asp:gridview>


Our requirement is that each gridview control must have a checkbox next to it.

Users are asked to fill all the textboxes in each gridview control.

However, if user does not see the need to complete the textboxes in any particular gridview control, then we need to have user check a box next to each gridview control to disable that gridview control.

If any gridview is not completed and a box is not checked, an error needs to be raised and user should not be allowed to submit the form.
Does anyone know to do this?

Thanks in advance
AnswerRe: How to disable gridview by checkbox? Pin
jkirkerx4-Dec-17 8:02
professionaljkirkerx4-Dec-17 8:02 
GeneralRe: How to disable gridview by checkbox? Pin
samflex4-Dec-17 8:48
samflex4-Dec-17 8:48 
GeneralRe: How to disable gridview by checkbox? Pin
jkirkerx4-Dec-17 10:11
professionaljkirkerx4-Dec-17 10:11 
GeneralRe: How to disable gridview by checkbox? Pin
samflex4-Dec-17 10:32
samflex4-Dec-17 10:32 
QuestionHow can I use CimCredential in Web Page to get Printer Status ? Pin
David Mujica28-Nov-17 7:31
David Mujica28-Nov-17 7:31 
AnswerRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
Richard Deeming28-Nov-17 8:36
mveRichard Deeming28-Nov-17 8:36 
GeneralRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
David Mujica28-Nov-17 8:39
David Mujica28-Nov-17 8:39 
GeneralRe: How can I use CimCredential in Web Page to get Printer Status ? Pin
Richard Deeming28-Nov-17 8:48
mveRichard Deeming28-Nov-17 8:48 
QuestionIIS Rewrite rule: Attach country code with all hyperlinks in page Pin
Mou_kol23-Nov-17 0:53
Mou_kol23-Nov-17 0:53 
Rant[REPOST] IIS Rewrite rule: Attach country code with all hyperlinks in page Pin
Richard Deeming23-Nov-17 1:01
mveRichard Deeming23-Nov-17 1:01 
QuestionLooking for MCSD Web Applications sample test Q/A Pin
Mou_kol22-Nov-17 22:12
Mou_kol22-Nov-17 22:12 
AnswerRe: Looking for MCSD Web Applications sample test Q/A Pin
Richard MacCutchan22-Nov-17 22:55
mveRichard MacCutchan22-Nov-17 22:55 
AnswerRe: Looking for MCSD Web Applications sample test Q/A Pin
F-ES Sitecore23-Nov-17 1:18
professionalF-ES Sitecore23-Nov-17 1:18 
QuestionProblem with wrap text in a column in gridview and reportviewer Pin
Member 1351227419-Nov-17 14:33
Member 1351227419-Nov-17 14:33 
AnswerRe: Problem with wrap text in a column in gridview and reportviewer Pin
Richard MacCutchan19-Nov-17 21:54
mveRichard MacCutchan19-Nov-17 21:54 
QuestionDataTable in .Net Core looks plain Pin
sn_lorun19-Nov-17 14:21
sn_lorun19-Nov-17 14:21 
AnswerRe: DataTable in .Net Core looks plain Pin
Richard Deeming20-Nov-17 2:14
mveRichard Deeming20-Nov-17 2:14 
GeneralRe: DataTable in .Net Core looks plain Pin
sn_lorun20-Nov-17 16:03
sn_lorun20-Nov-17 16:03 
QuestionHow to add country code or culture in url Pin
Mou_kol17-Nov-17 9:31
Mou_kol17-Nov-17 9:31 
QuestionLightbox questions based on a decision tree showed and updated in background Pin
Member 800771316-Nov-17 3:07
Member 800771316-Nov-17 3:07 
AnswerRe: Lightbox questions based on a decision tree showed and updated in background Pin
Richard MacCutchan16-Nov-17 3:17
mveRichard MacCutchan16-Nov-17 3:17 
GeneralRe: Lightbox questions based on a decision tree showed and updated in background Pin
Member 800771316-Nov-17 3:55
Member 800771316-Nov-17 3:55 
QuestionWebBrowser Control Pin
Michael Clinton8-Nov-17 7:15
Michael Clinton8-Nov-17 7:15 
AnswerRe: WebBrowser Control Pin
jkirkerx8-Nov-17 9:24
professionaljkirkerx8-Nov-17 9:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.