two different validation with two different buttons. in web application

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2009
Posts: 57
Reputation: facadie has a little shameless behaviour in the past 
Solved Threads: 0
facadie facadie is offline Offline
Junior Poster in Training

two different validation with two different buttons. in web application

 
0
  #1
Sep 28th, 2009
Hi

i have 3 textboxes, TBDate, TBRangeFrom, TBRangeTo.
I have use custom validation and insert code to validate date
but i need to use two different button to validate data in same webform.
For example
TBDate to use btn1 to validate and then when click will link to other form

whereas TBRangeFrom and TBRangeTo will use btn2 to validate and hence lead to another different form.. how am i going to make this happen?

because right now when i click just one button it will validate everything.=/
Last edited by facadie; Sep 28th, 2009 at 5:53 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 62
Reputation: chandru7 is an unknown quantity at this point 
Solved Threads: 11
chandru7 chandru7 is offline Offline
Junior Poster in Training

Re: two different validation with two different buttons. in web application

 
0
  #2
Sep 29th, 2009
can you please eloborate,post yours Code.

Thx,
Chandru
<FAKE SIGNATURE>
Last edited by peter_budo; Sep 30th, 2009 at 10:02 am. Reason: Keep It On The Site - Do not manually post "fake" signatures in your posts. Instead, you may create a sitewide signature within the user control panel.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 57
Reputation: facadie has a little shameless behaviour in the past 
Solved Threads: 0
facadie facadie is offline Offline
Junior Poster in Training

Re: two different validation with two different buttons. in web application

 
0
  #3
Sep 29th, 2009
Originally Posted by chandru7 View Post
can you please eloborate,post yours Code.

Thx,
Chandru
NetProgrammingHelp.com
  1. <%@ Page Language="C#" MasterPageFile="~/PATS.master" AutoEventWireup="true" CodeFile="Report.aspx.cs" Inherits="Report" Title="Untitled Page" %>
  2. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  3. <br />
  4. <div style="text-align: left">
  5. <table style="font-family: arial">
  6. <tr>
  7. <td style="width: 147px; height: 21px; text-align: right">
  8. <strong>Generate Report</strong></td>
  9. <td style="width: 176px; height: 21px">
  10. </td>
  11. <td style="width: 22px; height: 21px">
  12. </td>
  13. <td style="width: 176px; height: 21px">
  14. </td>
  15. </tr>
  16. <tr>
  17. <td style="width: 147px; height: 28px;">
  18. </td>
  19. <td style="width: 176px; height: 28px;">
  20. </td>
  21. <td style="width: 22px; height: 28px;">
  22. </td>
  23. <td style="width: 176px; height: 28px;">
  24. </td>
  25. </tr>
  26. <tr>
  27. <td style="width: 147px; height: 20px; text-align: right">
  28. By Date</td>
  29. <td style="width: 176px; height: 20px">
  30. <asp:TextBox ID="TBDate" runat="server"></asp:TextBox>
  31. <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="*" ControlToValidate="TBDate" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator></td>
  32. <td style="width: 22px; height: 20px">
  33. </td>
  34. <td style="width: 176px; height: 20px">
  35. </td>
  36. </tr>
  37. <tr>
  38. <td style="width: 147px">
  39. </td>
  40. <td style="width: 176px">
  41. <asp:Button ID="BTNGenerateDate" runat="server" Text="Generate" Width="80px" /></td>
  42. <td style="width: 22px">
  43. </td>
  44. <td style="width: 176px">
  45. </td>
  46. </tr>
  47. <tr>
  48. <td style="width: 147px; height: 41px;">
  49. </td>
  50. <td style="width: 176px; height: 41px;">
  51. </td>
  52. <td style="width: 22px; height: 41px;">
  53. </td>
  54. <td style="width: 176px; height: 41px;">
  55. </td>
  56. </tr>
  57. <tr>
  58. <td style="width: 147px; text-align: right">
  59. By Range</td>
  60. <td style="width: 176px">
  61. </td>
  62. <td style="width: 22px">
  63. </td>
  64. <td style="width: 176px">
  65. </td>
  66. </tr>
  67. <tr>
  68. <td style="width: 147px; text-align: right">
  69. <em>From</em></td>
  70. <td style="width: 176px">
  71. <asp:TextBox ID="TBRangeFrom" runat="server"></asp:TextBox></td>
  72. <td style="width: 22px; text-align: right">
  73. <em>To</em></td>
  74. <td style="width: 176px">
  75. <asp:TextBox ID="TBRangeTo" runat="server"></asp:TextBox></td>
  76. </tr>
  77. <tr>
  78. <td style="width: 147px">
  79. </td>
  80. <td style="width: 176px">
  81. <asp:Button ID="BTNGenerateRange" runat="server" Text="Generate" Width="80px" /></td>
  82. <td style="width: 22px">
  83. </td>
  84. <td style="width: 176px">
  85. </td>
  86. </tr>
  87. </table></div>
  88. <br />
  89. </asp:Content>

Hi i think with a picture you might understand what I'm trying to ask.=) cause Im usually not good at phrasing question.
Attached Images
File Type: bmp generate.bmp (415.0 KB, 1 views)
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 3,285
Reputation: sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of sknake has much to be proud of 
Solved Threads: 586
Sponsor
sknake's Avatar
sknake sknake is offline Offline
.NET Enthusiast

Re: two different validation with two different buttons. in web application

 
0
  #4
Sep 29th, 2009
Use a custom validator and validate it in code based on the postback button.
Scott Knake
Custom Software Development
Apex Software, Inc.
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 442
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training

Re: two different validation with two different buttons. in web application

 
1
  #5
Sep 30th, 2009
Use ValidationGroup property.

The ASP.NET controls have a ValidationGroup property that, when set, validates only the validation controls within the specified group when the control triggers a post back to the server.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 57
Reputation: facadie has a little shameless behaviour in the past 
Solved Threads: 0
facadie facadie is offline Offline
Junior Poster in Training
 
0
  #6
Oct 8th, 2009
Originally Posted by Ramesh S View Post
Use ValidationGroup property.

The ASP.NET controls have a ValidationGroup property that, when set, validates only the validation controls within the specified group when the control triggers a post back to the server.
yea i did saw that so i just type under validation group. like the textbox i want to validate and the btn when click then it validate or???
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 442
Reputation: Ramesh S will become famous soon enough Ramesh S will become famous soon enough 
Solved Threads: 82
Ramesh S Ramesh S is offline Offline
Posting Pro in Training
 
0
  #7
Oct 8th, 2009
The TextBox, Button controls should have same ValidationGroup. If you are using ValidationSummary, then you need to specifiy the ValidationGroup for it.

For your requirement, TBDate to use btn1 should have a ValidationGroup. TBRangeFrom, TBRangeTo and btn2 should have another ValidationGroup.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC