TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
avijit chatterjee
NA
16
0
after checked checkbox not showing...
Sep 14 2010 10:20 AM
(1)
I have two Checkbox id like----Check1 and Check2. after checked and other textboxes fieldup i am sending mail that page. what i want to do is when user view the page in mail checkbox should beviewed in place where that was while fill. please some one help me to get the solution.
(2)
Another problem is i am catching systemdate which not showing in proper format.like showing in 14\09\2010 and i want in 14/09/2010.
(3) and lastone i used ajax for calender but calender not showing.....
please someone help me....i am sending both .aspx and codebehind page....
/-----------------------------------.aspxpage----------------------------------------/
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="InsertPage.aspx.cs" Inherits="InsertPage" Title="Untitled Page" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<center>
<table>
<tr>
<td>
aaaaaaaaaaaaaaa
</td>
</tr>
</table>
</center>
<table>
<tr>
<td class="lbl" style="width: 607px"></td>
<td align ="left" style="width: 40px">
<asp:Label ID="lbldate" CssClass="lbl" runat="server" Width="43px">Date:-</asp:Label>
</td>
<td align="left" style="width: 100px">
<asp:Label ID="lblSysDate" CssClass="lblBoldBlue" runat="server"></asp:Label>
</td>
</tr>
</table>
<table>
<tr>
<td colspan = "0" style="width: 523px" class="lbl"></td>
<td align ="left" style="width: 10px">
<asp:Label ID="lblofficial_veh" CssClass="lbl" runat="server" Width="48px" >Official</asp:Label>
</td>
<td>
<asp:CheckBox ID="Check1" runat="server" Text="Official " TextAlign="Left"
oncheckedchanged="Check1_CheckedChanged" />
</td>
</tr>
<tr>
<td colspan = "0" style="width: 523px" class="lbl"></td>
<td align ="left" style="width: 27px">
<asp:Label ID="lblprivate_veh" CssClass="lbl" runat="server" Width="79px">Private</asp:Label>
</td>
<td>
<asp:CheckBox ID="Check2" runat="server" Text="Private " TextAlign="Left"
oncheckedchanged="Check2_CheckedChanged" />
</td>
</tr>
</table>
<center>
<table border="1px">
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="empcode" runat="server" Text="Empcode"></asp:Label>
</td>
<td align="left" style="width: 133px">
<asp:Label ID="lblempcode" runat="server" CssClass="lbl"></asp:Label>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="name" runat="server" Text="Name"></asp:Label>
</td>
<td align="left" style="width: 162px">
<asp:Label ID="lblname" runat="server" CssClass="lbl"></asp:Label>
</td>
</tr>
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="designation" runat="server" Text="Designation"></asp:Label>
</td>
<td align="left" style="width: 133px">
<asp:Label ID="lbldesignation" runat="server" CssClass="lbl"></asp:Label>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="department" runat="server" Text="Department"></asp:Label>
</td>
<td align="left" style="width: 162px">
<asp:DropDownList id="ddrdepartment" runat="server" AutoPostBack="true" Width="100px">
<asp:ListItem Text="Select" Value="Select" Selected="True"></asp:ListItem>
<asp:ListItem Text="Accounts" Value="Accounts"></asp:ListItem>
<asp:ListItem Text="Chargeable" Value="Chargeable"></asp:ListItem>
<asp:ListItem Text="Civil" Value="Civil"></asp:ListItem>
<asp:ListItem Text="DGSet" Value="DGSet"></asp:ListItem>
<asp:ListItem Text="Dispensary" Value="Dispensary"></asp:ListItem>
<asp:ListItem Text="Drawing Office" Value="Drawing Office"></asp:ListItem>
<asp:ListItem Text="Electrical" Value="Electrical"></asp:ListItem>
<asp:ListItem Text="Garage" Value="Garage"></asp:ListItem>
<asp:ListItem Text="Infotech" Value="Infotech"></asp:ListItem>
<asp:ListItem Text="Instrumentation" Value="Instrumentation"></asp:ListItem>
<asp:ListItem Text="K1" Value="K1"></asp:ListItem>
<asp:ListItem Text="Laboratory" Value="Laboratory"></asp:ListItem>
<asp:ListItem Text="Mechanical" Value="Mechanical"></asp:ListItem>
<asp:ListItem Text="Mines" Value="Mines"></asp:ListItem>
<asp:ListItem Text="Mumbai" Value="Mumbai"></asp:ListItem>
<asp:ListItem Text="Packing" Value="Packing"></asp:ListItem>
<asp:ListItem Text="PACKING MATERIAL" Value="PACKING MATERIAL"></asp:ListItem>
<asp:ListItem Text="Personal & Admin" Value="Personal & Admin"></asp:ListItem>
<asp:ListItem Text="Planning & Development" Value="Planning & Development"></asp:ListItem>
<asp:ListItem Text="Power Plant" Value="Power Plant"></asp:ListItem>
<asp:ListItem Text="Production" Value="Production"></asp:ListItem>
<asp:ListItem Text="Project" Value="Project"></asp:ListItem>
<asp:ListItem Text="Purchase" Value="Purchase"></asp:ListItem>
<asp:ListItem Text="Sales" Value="Sales"></asp:ListItem>
<asp:ListItem Text="DGSet" Value="DGSet"></asp:ListItem>
<asp:ListItem Text="Security" Value="Security"></asp:ListItem>
<asp:ListItem Text="Stores" Value="Stores"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" style="width: 156px" valign="top">
<asp:Label ID="lblVehiclereqdon" CssClass="lbl" runat="server" Width="122px" Text="VehicleReqdOn"></asp:Label></td>
<td valign="top" align="left" style="width: 133px">
<asp:TextBox ID="txtvehiclereqdon" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
<AjaxToolkit:CalendarExtender ID ="txtvehiclereqdon_CalendarExtender"
runat="server" Format="dd/MM/yyyy" TargetControlID="txtvehiclereqdon">
</AjaxToolkit:CalendarExtender>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblfromhour" runat="server" Text="From Hour"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtfrom_hour" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="lbltohour" runat="server" Text="To Hour"></asp:Label>
</td>
<td valign="top" align="left" style="width: 133px">
<asp:TextBox ID="txtto_hour" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblvisitplace" runat="server" Text="Place To Visit"></asp:Label>
</td>
<td align="left" style="width: 162px">
<asp:DropDownList id="ddrvisit_place" runat="server" Width="100px">
<asp:ListItem Value="abcdsdfgdf"></asp:ListItem>
<asp:ListItem Value="rrrradfgadf"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="lblreportvehicle" runat="server" Text="VehicleRptPer"></asp:Label>
</td>
<td valign="top" align="left" style="width: 133px">
<asp:TextBox ID="txtvehicle_rpt_person" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblreportlocation" runat="server" Text="VehicleRptLocn"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtvehicle_rpt_location" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="lblpurpose" runat="server" Text="Purpose"></asp:Label>
</td>
<td valign="top" align="left" style="width: 133px">
<asp:TextBox ID="txtpurpose" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblvehicle_no" runat="server" Text="Vehicle No"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtvehicle_no" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="width: 90px">
<asp:Label ID ="lbldrivername" runat="server" Text="Driver Name"></asp:Label>
</td>
<td valign="top" align="left" style="width: 133px">
<asp:TextBox ID="txtdriver_name" BackColor="White" ForeColor="Black" runat="server"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lbldeparturetime" runat="server" Text="Departure Time"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtdeparture_time" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="width: 102px">
<asp:Label ID ="lbldeparturekmsreading" runat="server" Text="DepartureKmsReading"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtdeparture_kms_reading" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblarrivaltime" runat="server" Text="Arrival Time"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtarrival_time" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
</tr>
<tr>
<td align="left" style="width: 102px">
<asp:Label ID ="lblarrivalkmsreading" runat="server" Text="ArrivalKmsReading"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtarrival_kms_reading" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="visiting_area" runat="server" Text="Visting Area"></asp:Label>
</td>
<td align="left" style="width: 162px">
<asp:DropDownList id="ddrvisiting_area" runat="server" Width="100px">
<asp:ListItem Value="abcdsdfgdf"></asp:ListItem>
<asp:ListItem Value="rrrradfgadf"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td align="left" style="width: 102px" visible="false">
<asp:Label ID ="lblin_time" runat="server" Text="In Time"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtin_time" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
<td>
</td>
<td align="left" style="width: 102px">
<asp:Label ID ="lblout_time" runat="server" Text="Out Time"></asp:Label>
</td>
<td valign="top" align="left" style="width: 162px">
<asp:TextBox ID="txtout_time" BackColor="White" ForeColor="Black"
runat="server" Width="119px"></asp:TextBox>
</td>
</tr>
</table>
</center>
<table>
<br />
<br />
<tr>
<td class="lbl" style="width: 189px"></td>
<td align="center" valign="top">
<asp:Button ID="btnSubmit" runat="server" BackColor="#6699cc"
BorderColor="#6699cc" BorderStyle="None" ForeColor="White" Width="77px"
Text="APPLY" OnClick="btnSubmit_Click" /></td>
<td><asp:Label ID="lblMsg" Visible="false" Text="Data Saved Successfully" runat="server" CssClass="Sucessful"></asp:Label></td>
</tr>
</table>
</asp:Content>
/-----------------------------------codebehind page---------------------------------------/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using VehicleFormApp.library;
public partial class InsertPage : System.Web.UI.Page
{
string sCompany = "MEH";
string sLocation = "RNC";
string scheck1 = "";
string scheck2 = "";
string sEmpCode = "022234";
string sname = "";
string sdesignation = "";
string sdepartment = "";
string svehicle_reqd_on = "";
string sfrom_hours = "";
string sto_hours = "";
string svisit_place = "";
string svehicle_rpt_person = "";
string svehicle_rpt_location = "";
string spurpose = "";
string svehicle_no = "";
string sdriver_name = "";
string sdeparture_time = "";
string sdeparture_kms_reading = "";
string sarrival_time = "";
string sarrival_kms_reading = "";
string svisiting_area = "";
string sin_time = "";
string sout_time = "";
string sSubject = "";
string stringBody = "";
string sUrl;
string sFromemail = "";
string sTomail = "";
string homeurl = "";
library lib = new library();
protected void Page_Load(object sender, EventArgs e)
{
HtmlLink cssLink = new HtmlLink();
cssLink.Href = "VehicleFormApp.css";
cssLink.Attributes.Add("rel", "stylesheet");
cssLink.Attributes.Add("type", "text/css");
Header.Controls.Add(cssLink);
//Session["urlval"] = Request.QueryString["homeval"].ToString();
library lib = new library();
if (!IsPostBack)
{
string sMode = "";
if (Request.QueryString["MEH"] != null && Convert.ToString(Request.QueryString["MEH"]) != "")
{
sCompany = Request.QueryString["MEH"];
}
if (Request.QueryString["02260"] != null && Convert.ToString(Request.QueryString["02260"]) != "")
{
sEmpCode = Request.QueryString["02260"];
}
if (Request.QueryString["mode"] != null && Convert.ToString(Request.QueryString["mode"]) != "")
{
sMode = Request.QueryString["mode"];
}
if (sMode == "view")
{
DataTable dtviewdata = null;
dtviewdata = lib.ViewData(sCompany, sEmpCode);
if (dtviewdata != null)
{
lblSysDate.Text = dtviewdata.Rows[0].ItemArray[0].ToString();
lblofficial_veh.Text = dtviewdata.Rows[0].ItemArray[1].ToString();
lblprivate_veh.Text = dtviewdata.Rows[0].ItemArray[2].ToString();
lblempcode.Text = dtviewdata.Rows[0].ItemArray[3].ToString();
lblname.Text = dtviewdata.Rows[0].ItemArray[4].ToString();
lbldesignation.Text = dtviewdata.Rows[0].ItemArray[5].ToString();
ddrdepartment.SelectedValue = dtviewdata.Rows[0].ItemArray[6].ToString();
txtvehiclereqdon.Text = dtviewdata.Rows[6].ItemArray[7].ToString();
txtfrom_hour.Text = dtviewdata.Rows[0].ItemArray[8].ToString();
txtto_hour.Text = dtviewdata.Rows[0].ItemArray[9].ToString();
ddrvisit_place.Text = dtviewdata.Rows[0].ItemArray[10].ToString();
txtvehicle_rpt_person.Text = dtviewdata.Rows[0].ItemArray[11].ToString();
txtvehicle_rpt_location.Text = dtviewdata.Rows[0].ItemArray[12].ToString();
txtpurpose.Text = dtviewdata.Rows[0].ItemArray[13].ToString();
txtvehicle_no.Text = dtviewdata.Rows[0].ItemArray[14].ToString();
txtdriver_name.Text = dtviewdata.Rows[0].ItemArray[15].ToString();
txtdeparture_time.Text = dtviewdata.Rows[0].ItemArray[16].ToString();
txtdeparture_kms_reading.Text = dtviewdata.Rows[0].ItemArray[17].ToString();
txtarrival_time.Text = dtviewdata.Rows[0].ItemArray[18].ToString();
txtarrival_kms_reading.Text = dtviewdata.Rows[0].ItemArray[19].ToString();
ddrvisiting_area.SelectedValue = dtviewdata.Rows[0].ItemArray[20].ToString();
txtin_time.Text = dtviewdata.Rows[0].ItemArray[21].ToString();
txtout_time.Text = dtviewdata.Rows[0].ItemArray[22].ToString();
}
}
else
{
lblSysDate.Text = DateTime.Today.ToString("dd/MM/yyyy");
lblofficial_veh.Text = scheck1;
lblprivate_veh.Text = scheck2;
lblempcode.Text = sEmpCode;
DataTable dtname = lib.getUserDetail(sCompany, sEmpCode.Trim());
lblname.Text = dtname.Rows[0].ItemArray[0].ToString() + " " + dtname.Rows[0].ItemArray[1].ToString() + " " + dtname.Rows[0].ItemArray[2].ToString();
DataTable dtdesignation = lib.getEmpDesignation(sCompany, sEmpCode);
lbldesignation.Text = dtdesignation.Rows[0].ItemArray[0].ToString();
ddrdepartment.SelectedValue = sdepartment;
txtvehiclereqdon.Text = svehicle_reqd_on;
txtfrom_hour.Text = sfrom_hours;
txtto_hour.Text = sto_hours;
ddrvisit_place.Text = svisit_place;
txtvehicle_rpt_person.Text = svehicle_rpt_person;
txtvehicle_rpt_location.Text = svehicle_rpt_location;
txtpurpose.Text = spurpose;
txtvehicle_no.Text = svehicle_no;
txtdriver_name.Text = sdriver_name;
txtdeparture_time.Text = sdeparture_time;
txtdeparture_kms_reading.Text = sdeparture_kms_reading;
txtarrival_time.Text = sarrival_time;
txtarrival_kms_reading.Text = sarrival_kms_reading;
ddrvisiting_area.SelectedValue = svisiting_area;
txtin_time.Text = sin_time;
txtout_time.Text = sout_time;
}
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
library lib = new library();
if (Request.QueryString["MEH"].ToString() == "MEH")
{
string strcur_date = lblSysDate.Text.Trim();
string strofficial_veh = Check1.Text.Trim();
string strprivate_veh = Check2.Text.Trim();
string strempcode = lblempcode.Text.Trim();
string strname = lblname.Text.Trim();
string strdesignation = lbldesignation.Text.Trim();
string strdepartment = ddrdepartment.SelectedValue.Trim();
string strvehiclereqdon = txtvehiclereqdon.Text.Trim();
string strfrom_hour = txtfrom_hour.Text.Trim();
string strto_hour = txtto_hour.Text.Trim();
string strvisit_place = ddrvisit_place.SelectedValue.Trim();
string strvehicle_rpt_person = txtvehicle_rpt_person.Text.Trim();
string strvehicle_rpt_location = txtvehicle_rpt_location.Text.Trim();
string strpurpose = txtpurpose.Text.Trim();
string strvehicle_no = txtvehicle_no.Text.Trim();
string strdriver_name = txtdriver_name.Text.Trim();
string strdeparture_time = txtdeparture_time.Text.Trim();
string strdeparture_kms_reading = txtdeparture_kms_reading.Text.Trim();
string strarrival_time = txtarrival_time.Text.Trim();
string strarrival_kms_reading = txtarrival_kms_reading.Text.Trim();
string strvisiting_area = ddrvisiting_area.SelectedValue.Trim();
string strin_time = txtin_time.Text.Trim();
string strout_time = txtout_time.Text.Trim();
lib.InsertData(strcur_date, strofficial_veh, strprivate_veh, strempcode, strname, strdesignation, strdeparture_time,strvehiclereqdon,strfrom_hour,strto_hour,strvisit_place,strvehicle_rpt_person,strvehicle_rpt_location,strpurpose,strvehicle_no,strdriver_name,strdeparture_time,strdeparture_kms_reading,strarrival_time,strarrival_kms_reading,strvisiting_area,strin_time,strout_time);
btnSubmit.Visible = false;
Sendmail objSendMail = new Sendmail();
//sUrl = "http://192.168.3.4/VehicleFormApp/InsertPage.aspx?";
sUrl += "empcode=" + strempcode + "&";
sUrl += "comcode=" + sCompany + "&";
sUrl += "mode=view";
if (strempcode != null)
{
DataTable dtuserempcode = new DataTable();
dtuserempcode = lib.getuseremail(sCompany, strempcode.Trim());
sFromemail = dtuserempcode.Rows[0].ItemArray[0].ToString();
sTomail = dtuserempcode.Rows[0].ItemArray[1].ToString();
if (sTomail != "")
{
DataTable dtusername = lib.getUserDetail(sCompany, sEmpCode.Trim());
string sFullName = "";
if (dtusername != null)
{
if (dtusername.Rows.Count > 0)
{
sFullName = dtusername.Rows[0].ItemArray[0].ToString() + " " + dtusername.Rows[0].ItemArray[1].ToString() + " " + dtusername.Rows[0].ItemArray[2].ToString();
}
}
sSubject = "Vehicle requisition Form - of" + sFullName + " " + DateTime.Now.ToString();
stringBody = stringBody + "<HTML><HEAD><TITLE></TITLE></HEAD>";
stringBody = stringBody + "<BODY style=font-family:Verdana;font-size:13px>";
stringBody = stringBody + "<table border=0 cellspacing=1 cellpadding=1 width=100%>";
stringBody = stringBody + "<tr><td>";
stringBody = stringBody + "DEAR SIR / MADAM,";
stringBody = stringBody + "</td>";
stringBody = stringBody + "</tr>";
stringBody = stringBody + "<tr><td> </td></tr>";
stringBody = stringBody + "<tr><td>PLEASE<a href=" + sUrl + " target=_blank> CLICK HERE </a> To Check the Vehicle Requisition Form Of " + sFullName + "</td>";
stringBody = stringBody + "<tr><td> </td></tr>";
stringBody = stringBody + "<tr><td>REGARDS,</td></tr>";
stringBody = stringBody + "</table>";
stringBody = stringBody + "</BODY></HTML>";
objSendMail.SendeMail(sCompany, sFromemail, sTomail, sSubject, stringBody);
lblMsg.Text = "Data Saved Successfully and Mail send to :-";
}
}
}
}
protected void Check1_CheckedChanged(object sender, EventArgs e)
{
CheckBox Check1 = sender as CheckBox;
if (Check1 != null)
{
if (Check1.Checked)
{
}
}
}
protected void Check2_CheckedChanged(object sender, EventArgs e)
{
CheckBox Check2 = sender as CheckBox;
if (Check2 != null)
{
if (Check2.Checked)
{
}
}
}
}
please help me....
lots of thanks.
Reply
Answers (
1
)
Filtering DataTable Against Second DataTable
Counting Application