how to fix the design in C#

ammartahir1978
ammartahir1978 used Ask the Experts™
on
hi all i have a code which is sending details to users in an email but when user recieve the emal its not aligned properly can you please help here is the code: and also attached the image from email to user and in there you can see there a mis alignment which headings.

now what i want is to keep heading aligned and user iputted value come after the :


System.Collections.Specialized.NameValueCollection nvc = new System.Collections.Specialized.NameValueCollection();
				nvc.Add("Customer Refernce",req.CUSTOMER_REF);
				nvc.Add("Delivery Address",req.DELIVERY_ADDRESS);
				nvc.Add("Invoice Address",req.INVOICE_ADDRESS);
				nvc.Add("Purchase Order - 101",req.PURCHASE_ORDER);
				nvc.Add("Purchase Order - 104",req.FUTURE_FIELD_1);
				nvc.Add("Department Reference",req.DEPARTMENT_REFERENCE);
				nvc.Add("Department Code",req.DEPARTMENT_CODE);
				nvc.Add("Dispatch Date",txtDispatchDate.Text);
				nvc.Add("Delivery Reference",req.DELIVERY_REFERENCE);
				nvc.Add("Reason Request",req.REASON_REQUEST);
				nvc.Add("Sample Form Completed By",req.SAMPLE_FORM_COMPLETED_BY);
				nvc.Add("Print Name",req.PRINT_NAME);

Open in new window

email-to-user.jpg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
share the full code which produces this output.....

Author

Commented:
here you go
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using SVT.USERLOCATIONS.BLL;
using SVT.USERLOCATIONS.UIUtility;
using SVT.USERLOCATIONS.Utility;
using SVT.USERLOCATIONS.Collections;
using SVT.USERLOCATIONS.UserControls;
using SVT.Controls;
using System.Text;

namespace SVT.USERLOCATIONS
{
	/// <summary>
	/// Summary description for Requests.
	/// </summary>
	/// <remarks>
	///		Created On : 29/01/2010
	///		Author     : Kazim
	///</remarks> 
	public class Requests : UserLocationsPage
	{
		#region GUI Controls
		protected SVT.Controls.SmartCabLiteral ltrMsg;
		protected SVT.Controls.SmartCabDataGrid grdJobs;
		protected SVT.Controls.SmartCabButton btnSubmit;


		protected SVT.Controls.SmartCabTextBox txt;
		protected SVT.Controls.SmartCabTextBox txtCustomerRef;
		protected SVT.Controls.SmartCabTextBox txtDeliveryAddress;
		protected SVT.Controls.SmartCabTextBox txtInvoiceAddress;
		protected SVT.Controls.SmartCabTextBox txtPurchaseOrder101;
		protected SVT.Controls.SmartCabTextBox txtPurchaseOrder104;
		protected SVT.Controls.SmartCabTextBox txtDispatchDate;
		protected SVT.Controls.SmartCabTextBox txtDepartmentReference;
		protected SVT.Controls.SmartCabTextBox txtDeliveryReference;
		protected SVT.Controls.SmartCabDropDownList cboDepartmentCode;
		protected SVT.Controls.SmartCabTextBox txtReasonRequest;
		protected SVT.Controls.SmartCabTextBox txtSampleFormCompletedBy;
		protected SVT.Controls.SmartCabTextBox txtPrintName;
		protected SVT.Controls.SmartCabTextBox txtDate;

		protected SVT.Controls.SmartCabLiteral ltrTotalUnitsOrdered;
		protected SVT.Controls.SmartCabLiteral ltrTotalUnitsDispatched;
		protected SVT.Controls.SmartCabLiteral ltrTotalCartons;

		Employees emp = new Employees();
		#endregion


		private void Page_Load(object sender, System.EventArgs e)
		{
			if(Session[SessionKeys.USER_EMAIL]==null || Utils.FixNullString(Session[SessionKeys.USER_EMAIL])==string.Empty)
				Response.Redirect("Login.aspx");

			ltrMsg.Text="";
			emp=Employees.ToObject(Utils.FixNullString(Session[SessionKeys.USER_PROFILE]));
			if(!IsPostBack)
			{
				ConfigurePageControls();
				PopulatePageControls();	
				RequestDetailCollection requests=null;
				requests = GetSessionRequests();
				BindGrid(requests);
				
			}
		}
		private void ConfigurePageControls()
		{
			btnSubmit.Attributes.Add("OnClick","return isFormValid();");
			cboDepartmentCode.Attributes.Add("OnChange","setReference();");
		}
		private void PopulatePageControls()
		{
//			ltrDateTime.Text = DateTime.Now.ToString();
//			ltrReferenceNum.Text =  GetAutoReferenceNumber();
//			ltrUserName.Text = emp.USER_NAME;
//			ltrDepartment.Text = emp.FUTURE_FIELD_2;
//			ltrEmail.Text = emp.USER_EMAIL;
 		}

 		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion


		#region Bind Grid

		protected void BindGrid(RequestDetailCollection jobs) 
		{ 
//			RadioCity rc = new RadioCity();
//			rc.Shift_Begin_Row_Id = shiftBegin.Shift_Begin_Row_Id;
//			
//			ds = rc.Load(shiftBegin);
//			grdRadioCity.DataSource = ds;
//			UIUtils.BindGrid(grdRadioCity);
			grdJobs.DataSource=jobs;
			grdJobs.DataBind();
		}
		
 
		#endregion

		protected void grdJobs_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
//			if(e.Item.ItemType == ListItemType.Header)
//			{
//				JobsCollection jobs = GetSessionJobs();
//				if(jobs.Count==0)
//					e.Item.Cells[e.Item.Cells.Count-1].Text=string.Empty;
//				else
//					e.Item.Cells[e.Item.Cells.Count-1].Text="<u>Edit</u>&nbsp;<u>Delete</u>";
//			}
			if( e.Item.ItemType == ListItemType.Footer  )
			{
				SmartCabTextBox txtProductCodeFooter=((SmartCabTextBox)e.Item.FindControl("txtProductCodeFooter"));
				SmartCabTextBox txtUnitsOrderedFooter=((SmartCabTextBox)e.Item.FindControl("txtUnitsOrderedFooter"));
				SmartCabDropDownList cboWarehouseFooter=((SmartCabDropDownList)e.Item.FindControl("cboWarehouseFooter"));
				SmartCabTextBox txtDescriptionFooter=((SmartCabTextBox)e.Item.FindControl("txtDescriptionFooter"));
				SmartCabTextBox txtSizeFooter=((SmartCabTextBox)e.Item.FindControl("txtSizeFooter"));
				SmartCabTextBox txtCaseSize=((SmartCabTextBox)e.Item.FindControl("txtCaseSizeFooter"));
				SmartCabTextBox txtUnitsDispatched=((SmartCabTextBox)e.Item.FindControl("txtUnitsDispatchedFooter"));
				SmartCabTextBox txtTotalCartons=((SmartCabTextBox)e.Item.FindControl("txtTotalCartonsFooter"));
				SmartCabTextBox txtBBDPerBatch=((SmartCabTextBox)e.Item.FindControl("txtBBDPerBatchFooter"));
				((SmartCabImageButton)e.Item.FindControl("btnInsert")).Attributes.Add("onClick","return isValidRow("+
					txtProductCodeFooter.ClientID	+","+
					txtUnitsOrderedFooter.ClientID	+","+
					cboWarehouseFooter.ClientID		+","+
					txtDescriptionFooter.ClientID	+","+
					txtSizeFooter.ClientID			+","+
					txtCaseSize.ClientID			+","+
					txtUnitsDispatched.ClientID		+","+
					txtTotalCartons.ClientID		+","+
					txtBBDPerBatch.ClientID			+")");
				
				txtUnitsOrderedFooter.MaxLength = 10;
				txtUnitsDispatched.MaxLength = 10;
				txtTotalCartons.MaxLength = 10;
			}
			
			if(e.Item.ItemType ==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
			{
				((SmartCabImageButton)e.Item.FindControl("btnDelete")).Attributes.Add("onClick","return confirm('Are you sure you want to delete this record?')");
			}
//			if(e.Item.ItemType ==ListItemType.EditItem)
//			{
//				SmartCabTextBox txtLocation=((SmartCabTextBox)e.Item.FindControl("txtLocation"));
//				SmartCabTextBox txtSystemName=((SmartCabTextBox)e.Item.FindControl("txtSystemName"));
//				SmartCabTextBox txtIPAddress=((SmartCabTextBox)e.Item.FindControl("txtIPAddress"));
//				SmartCabTextBox txtManager=((SmartCabTextBox)e.Item.FindControl("txtManager"));
//				SmartCabTextBox txtDescription=((SmartCabTextBox)e.Item.FindControl("txtDescription"));
//				((SmartCabImageButton)e.Item.FindControl("btnUpdate")).Attributes.Add("onClick","return isValidRow("+txtLocation.ClientID+","+txtSystemName.ClientID+","+txtIPAddress.ClientID+","+txtManager.ClientID+","+txtDescription.ClientID+")");
//			}
		}
		
		protected void Calculate()
		{
			int TotalUnitsOrdered=0;
			int TotalUnitsDispatched=0;
			int TotalCartons=0;
			for (int i = 0 ; i < grdJobs.Items.Count; i++)
			{
				SmartCabLabel lblUnitsOrdered = (SmartCabLabel)grdJobs.Items[i].FindControl("lblUnitsOrdered");
				TotalUnitsOrdered += Utils.FixNullInt(lblUnitsOrdered.Text);

				SmartCabLabel lblUnitsDispatched = (SmartCabLabel)grdJobs.Items[i].FindControl("lblUnitsDispatched");
				TotalUnitsDispatched += Utils.FixNullInt(lblUnitsDispatched.Text);


				SmartCabLabel lblTotalCartons = (SmartCabLabel)grdJobs.Items[i].FindControl("lblTotalCartons");
				TotalCartons += Utils.FixNullInt(lblTotalCartons.Text);

			}

			ltrTotalUnitsOrdered.Text = Utils.FixNullString(TotalUnitsOrdered);
			ltrTotalUnitsDispatched.Text = Utils.FixNullString(TotalUnitsDispatched);
			ltrTotalCartons.Text = Utils.FixNullString(TotalCartons);

		}

		protected void grdJobs_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs E) 
		{ 
//			RadioCity p = new RadioCity();
			if (E.CommandName.ToLower().Trim() == "insert") 
			{ 
				RequestDetail reqDetail = new RequestDetail();
				
				reqDetail.REQUEST_DETAIL_ROW_ID = Utils.FixNullString(grdJobs.Items.Count+1);
				reqDetail.PRODUCT_CODE = Utils.FixNullString(((TextBox)E.Item.FindControl("txtProductCodeFooter")).Text);
				reqDetail.UNITS_ORDERED = Utils.FixNullString(((TextBox)E.Item.FindControl("txtUnitsOrderedFooter")).Text); 
				reqDetail.WAREHOUSE = Utils.FixNullString(((DropDownList)E.Item.FindControl("cboWarehouseFooter")).SelectedValue); 
				reqDetail.SAMPLING_REASON_CODE = Utils.FixNullString(((DropDownList)E.Item.FindControl("cboSamplingReasonCodeFooter")).SelectedValue); 
				reqDetail.DESCRIPTION = Utils.FixNullString(((TextBox)E.Item.FindControl("txtDescriptionFooter")).Text); 
				reqDetail.SIZE = Utils.FixNullString(((TextBox)E.Item.FindControl("txtSizeFooter")).Text); 
				reqDetail.CASE_SIZE = Utils.FixNullString(((TextBox)E.Item.FindControl("txtCaseSizeFooter")).Text); 
				reqDetail.UNITS_DISPATCHED = Utils.FixNullString(((TextBox)E.Item.FindControl("txtUnitsDispatchedFooter")).Text); 
				reqDetail.TOTAL_CARTONS = Utils.FixNullString(((TextBox)E.Item.FindControl("txtTotalCartonsFooter")).Text); 
				reqDetail.BBD_PER_BATCH = Utils.FixNullString(((TextBox)E.Item.FindControl("txtBBDPerBatchFooter")).Text);

Open in new window

Commented:
Where is the function that sends the e-mail?
All you need to do is increase the column width of "Customer Reference" and Deleivery Address".
This will solve your issue

Author

Commented:
good

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial