473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Button problem

115 100+
hi All

my form contains lot of text box and 2 button one button is submit button and another one is calendar button when i am click this calendar button calendar is shown. i am creating required field validation for all fields . but this time am click calender show button calendar doesnot shown, but validation control work (ie * keys shown)

how can i solve this problem
1.when i am click submit button that times only validation control work,
2. when i am click calendar button click that time calendar shown

this is my requirement


pls give me immd solution

thanks
May 26 '08 #1
4 1233
debasisdas
8,127 Expert 4TB
kindly post the code that you are working on.
May 26 '08 #2
Set ValidationGroup="Validation" property on all text boxes, Validation controls and submit button. So the validation works with in group.

Regards,
Prakash N
May 26 '08 #3
yogarajan
115 100+
hi My code

my aspx page
<--Start here -->
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="ChangeNote.aspx.cs" Inherits="ChangeNote" Title="Untitled Page" %>
  2. <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
  3. <table width="100%" cellpadding="0" cellspacing="0" border="1">
  4.     <tr>
  5.         <td>
  6.             <img src="images/marg.jpg" /></td><td align="center" style="width: 486px">
  7.             <strong>Change Note</strong></td>
  8.     </tr>
  9.     <tr><td><b>Name of the Website</b></td><td style="width: 486px">
  10.         <asp:TextBox ID="txtwebsitename" runat="server" Width="355px"></asp:TextBox>
  11.         <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtwebsitename"
  12.             ErrorMessage="*"></asp:RequiredFieldValidator></td></tr>
  13.     <tr><td><b>Requested Date </b></td><td style="width: 486px">
  14.         <asp:TextBox ID="txtreqdate" runat="server"></asp:TextBox>
  15.         <asp:Button ID="Button2" runat="server" Text="calendar" OnClick="Button2_Click" />
  16.         <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtreqdate"
  17.             ErrorMessage="*"></asp:RequiredFieldValidator></td></tr>
  18.     <tr><td><b>Webpage Name</b></td><td style="width: 486px">
  19.         <asp:TextBox ID="txtwebpagename" runat="server" Width="355px"></asp:TextBox>
  20.         <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtwebpagename"
  21.             ErrorMessage="*"></asp:RequiredFieldValidator></td></tr>
  22.     <tr><td colspan="2"><b>Changes Required on Image </b></td></tr>
  23.     <tr><td colspan="2" style="height: 151px">
  24.         <asp:TextBox ID="txtimagechange" runat="server" Rows="8" TextMode="MultiLine" Width="724px"></asp:TextBox></td></tr>
  25.     <tr><td colspan="2"><b>Changed Required on Content</b></td></tr>
  26.     <tr><td colspan="2">
  27.         <asp:TextBox ID="txtcontentchange" runat="server" Rows="8" TextMode="MultiLine" Width="724px"></asp:TextBox></td></tr>
  28.     <tr><td colspan="2"><b>Changes Required on Functionality</b></td></tr>
  29.     <tr><td colspan="2">
  30.         <asp:TextBox ID="txtfunctionalitychange" runat="server" Rows="8" TextMode="MultiLine" Width="724px"></asp:TextBox></td></tr>
  31.     <tr><td colspan="2"><b>Requested By</b></td></tr>
  32.     <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Name</b></td><td style="width: 486px">
  33.         <asp:TextBox ID="txtreqname" runat="server" Width="355px"></asp:TextBox>
  34.         <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtreqname"
  35.             ErrorMessage="*"></asp:RequiredFieldValidator></td></tr>
  36.     <tr><td><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mail ID</b></td><td style="width: 486px">
  37.         <asp:TextBox ID="txtreqemail" runat="server" Width="355px"></asp:TextBox>
  38.         <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtreqemail"
  39.             ErrorMessage="*"></asp:RequiredFieldValidator>
  40.         <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtreqemail"
  41.             ErrorMessage="Valid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></td></tr>
  42.     <tr><td colspan="2"><b>Authorised By</b></td></tr>
  43.     <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Name</b></td><td style="width: 486px">
  44.         <asp:TextBox ID="txtappname" runat="server" Width="355px"></asp:TextBox></td></tr>
  45.     <tr><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Mail ID</b></td><td style="width: 486px">
  46.         <asp:TextBox ID="txtappmail" runat="server" Width="355px"></asp:TextBox>
  47.         <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtappmail"
  48.             ErrorMessage="Valid Email" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator></td></tr>
  49.     <tr><td colspan ="2"></td></tr>
  50.     <tr><td colspan="2" align="center">
  51.         <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" /></td></tr>
  52. </table>
  53. <div style="left: 390px; position: absolute; top: 120px">
  54.     <asp:Calendar ID="Calendar1" runat="server" Visible="false" OnSelectionChanged="Calendar1_SelectionChanged">
  55.         <SelectedDayStyle BackColor="Blue" BorderColor="Navy" BorderStyle="Solid" />
  56.         <DayStyle BackColor="#C0C0FF" BorderColor="Black" BorderStyle="Solid" />
  57.         <OtherMonthDayStyle BackColor="Silver" BorderColor="#404040" BorderStyle="Solid" />
  58.         <NextPrevStyle BackColor="Gray" />
  59.         <DayHeaderStyle BackColor="#C0C0FF" BorderColor="Blue" BorderStyle="Solid" />
  60.     </asp:Calendar>
  61.         </div>
  62. </asp:Content>
  63.  
< -- End here -->

cs code here

< -- Start here -->
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. using System.Data;
  3. using System.Configuration;
  4. using System.Collections;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.WebControls;
  9. using System.Web.UI.WebControls.WebParts;
  10. using System.Web.UI.HtmlControls;
  11.  
  12.  
  13. public partial class ChangeNote : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.  
  18.     }
  19.     protected void Button2_Click(object sender, EventArgs e)
  20.     {
  21.         if (Calendar1.Visible == true)
  22.         {
  23.             Calendar1.Visible = false;
  24.         }
  25.         else
  26.         {
  27.             Calendar1.Visible = true;
  28.         }
  29.     }
  30.     protected void Calendar1_SelectionChanged(object sender, EventArgs e)
  31.     {
  32.         DateTime calseldate=Convert.ToDateTime(Calendar1.SelectedDate);
  33.         txtreqdate.Text = calseldate.ToString("dd-MMM-yyyy");
  34.         Calendar1.Visible = false;
  35.  
  36.     }
  37.     protected void Button1_Click(object sender, EventArgs e)
  38.     {
  39.         string pstrClientAddress = HttpContext.Current.Request.UserHostAddress;
  40.         string strwebsitename = txtwebsitename.Text;
  41.         DateTime dtreqdate =Convert.ToDateTime( txtreqdate.Text);
  42.         string strwebpagename = txtwebpagename.Text;
  43.         string strimgchange = txtimagechange.Text;
  44.         string strconchange = txtcontentchange.Text;
  45.         string strfunchange = txtfunctionalitychange.Text;
  46.         string strreqname = txtreqname.Text;
  47.         string strreqemail = txtreqemail.Text;
  48.         string strapp = txtappname.Text;
  49.         string strappemail = txtappmail.Text;
  50.  
  51.         string imgfilepath = Convert.ToString(Request.Url);
  52.         char[] splitter = { '/' };
  53.         string imgfile="";
  54.         string[] arInfo = new string[100];
  55.         arInfo = imgfilepath.Split(splitter);
  56.         //string imgfile;
  57.  
  58.         for (int x = 0; x < arInfo.Length-1; x++)
  59.         {
  60.             //Response.Write(arInfo[x] + "<br>");
  61.             if (imgfile == "")
  62.             {
  63.                 imgfile =  Convert.ToString(arInfo[x]);
  64.             }
  65.             else
  66.             {
  67.                 imgfile = imgfile + "/" + Convert.ToString(arInfo[x]);
  68.             }
  69.         }
  70.  
  71.         DataSetmargreqTableAdapters.MargchangeTableAdapter margchange = new DataSetmargreqTableAdapters.MargchangeTableAdapter();
  72.         strimgchange = strimgchange.Replace("\n", "<br>");
  73.         strconchange = strconchange.Replace("\n", "<br>");
  74.         strfunchange = strfunchange.Replace("\n", "<br>");
  75.         margchange.Insertmargchange(strwebsitename, strreqname, strreqemail, dtreqdate, strwebpagename, strimgchange, strconchange, strfunchange, pstrClientAddress);
  76.         marg margemail = new marg();
  77.         //bool suc = margemail.mailchangenotesend(strreqemail, strappemail, strmailsubject, strimgchange, strconchange, strfunchange);
  78.         bool suc = margemail.changenotemailsend(strwebsitename, txtreqdate.Text, strwebpagename, strimgchange, strconchange, strfunchange, strreqname, strreqemail, strapp, strappemail, imgfile);
  79.         if (suc == true)
  80.         {
  81.             Response.Redirect("reqconfirm.aspx?ack=suc");
  82.         }
  83.         else
  84.         {
  85.             Response.Redirect("reqconfirm.aspx?ack=fail");
  86.         }
  87.  
  88.  
  89.     }
  90. }
< -- End here -->
May 26 '08 #4
Frinavale
9,735 Expert Mod 8TB
I can't remember much on how to use the Validator controls but I think what you're looking for has something to do with the ValidationGroup Property.

You could also consider using JavaScript and CSS to make your calendar control visible on your client side instead of doing a page submit. This will save you bandwidth, time, and server resources.

As a full member you are expected to use [code] tags. In the future please remember these tags when posting code snippets.

-Moderator Frinny
May 26 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: JR | last post by:
Hi. I hope someone out there who is more versed with JavaScript than I can help me with the following annoying problem. Here's the problem. I have a form with the following layout: Column A...
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
3
by: Jason Kyle Baginski | last post by:
Here's a little test app to demonstrate a problem I'm having. It creates four buttons, each one with the different FlatStyle types available. Three of them behave exactly the same way(and the...
6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
10
by: tasmisr | last post by:
This is an old problem,, but I never had it so bad like this before,, the events are refiring when clicking the Browser refresh button. In the Submit button in my webform, I capture the server side...
1
by: Klaus Jensen | last post by:
Hi! This has been annoying me all day, and I can't get it to work It is really driving me nuts! Basicly this simple webapp created to illustrate my problem, renders five buttons, and adds a...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
14
by: Kevin | last post by:
A couple of easy questions here hopefully. I've been working on two different database projects which make use of multiple forms. 1. Where's the best/recommended placement for command buttons...
4
by: glbdev | last post by:
Hi, I posted this question yesterday but didn't get the answer I needed. I am DESPERATE to get this working so I'm re-posting it because I don't think I worded it correctly. I have a GridView...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.