|
Sent..
|
|
|
|
|
Simplest option would be use UpdatePanel put both dropDowns in Update panel , and just write the normal code (ie:- Server side code on Selected Index Change Event of Country DropDown)
|
|
|
|
|
namespace WebApplicationDlh
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Db;
/// <summary>
/// Area
/// </summary>
public class Area : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.DropDownList ddlProvince;
protected System.Web.UI.WebControls.DropDownList ddlCity;
public string strProvince
{
get
{
return ddlProvince.SelectedItem.Value;
}
set
{
ddlProvince.SelectedItem.Value = value;
}
}
public string strCity
{
get
{
return ddlCity.SelectedItem.Value;
}
set
{
ddlCity.SelectedItem.Value = value;
}
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
ddlProvinceBind();
ddlCity.Items.Insert(0,"-City to choose-");
}
}
private void ddlProvinceBind()
{
Db.Area myArea = new Db.Area();
SqlDataReader dr = myArea.GetAllProvince();
if(dr.Read())
{
ddlProvince.DataSource = dr;
ddlProvince.DataTextField = "Province";
ddlProvince.DataValueField = "Province";
ddlProvince.DataBind();
ddlProvince.Items.Insert(0,"-Province to choose-");
}
}
#region Web
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
///
///
/// </summary>
private void InitializeComponent()
{
this.ddlProvince.SelectedIndexChanged += new System.EventHandler(this.ddlProvince_SelectedIndexChanged);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void ddlProvince_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(ddlProvince.SelectedItem.Value == "-Province to choose-")
{
ddlCity.Items.Clear();
ddlCity.Items.Insert(ddlProvince.SelectedIndex,"-City to choose-");
}
else
{
Db.Area myArea = new Db.Area();
SqlDataReader dr = myArea.GetAllCityWhereProvince(ddlProvince.SelectedItem.Value);
if(dr.Read())
{
ddlCity.DataSource = dr;
ddlCity.DataTextField = "City";
ddlCity.DataValueField = "ID";
ddlCity.DataBind();
}
}
}
}
}
=============================================================〉
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace Db
{
/// <summary>
/// Area
/// </summary>
public class Area:Base
{
public Area()
{
//
// TODO:
//
}
public SqlDataReader GetAllProvince()
{
strSp = "Sp_Area_SelectAll";
drSelectAll(strSp);
return dr;
}
public SqlDataReader GetAllCityWhereProvince(string a)
{
conn = new SqlConnection(ConfigurationSettings.AppSettings["dsn"]);
cmd = new SqlCommand("Sp_Area_SelectAllWhereProvince",conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Province",SqlDbType.VarChar,50).Value = a.ToString();
conn.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}
}
}
=====================================================〉
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Sp_Area_SelectAll]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1)
drop procedure [dbo].[Sp_Area_SelectAll]
GO
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Sp_Area_SelectAllWhereProvince]’) and OBJECTPROPERTY(id, N’IsProcedure’) = 1)
drop procedure [dbo].[Sp_Area_SelectAllWhereProvince]
GO
if exists (select * from dbo.sysobjects where id = object_id(N’[dbo].[Area]’) and OBJECTPROPERTY(id, N’IsUserTable’) = 1)
drop table [dbo].[Area]
GO
CREATE TABLE [dbo].[Area] (
[ID] [int] NOT NULL ,
[Province] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[City] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL ,
[其它] [varchar] (50) COLLATE Chinese_PRC_CI_AS NULL
) ON [PRIMARY]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE Sp_Area_SelectAll
AS
SELECT DISTINCT Province
FROM Area
ORDER BY Province
RETURN
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE Sp_Area_SelectAllWhereProvince
@Province varchar(50)
AS
SELECT Area.*
FROM Area
WHERE (Province = @Province)
RETURN
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
================================================〉
using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration; namespace Db
{
/// <summary>
/// Base
/// </summary>
public class Base
{
public Base()
{
//
// TODO:
//
}
protected string con = ConfigurationSettings.AppSettings["dsn"];
protected SqlConnection conn;
protected SqlCommand cmd;
protected SqlDataReader dr;
protected string strSp;
protected SqlDataReader drSelectAll(string strSp)
{
conn = new SqlConnection(con);
cmd = new SqlCommand(strSp,conn);
cmd.CommandType = CommandType.StoredProcedure; conn.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
return dr;
}//SqlDataReader }
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 21:55pm.
|
|
|
|
|
Respected,
Error message : Could not find a part of the path 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\BLDocuments\34555.PDF'.
This is the Error of below code.
See below code and tell me why this error created.....help Me ..
string pdfFileNameNew = Request.PhysicalApplicationPath + "PDFsToAttach\\PDFAgent_123 " + DateTime.Now.ToString("dd-MMM-yyyy") + "_" + DateTime.Now.ToString("HHmmss") + ".PDF";
int retVal = CreatePDF(sdrOwnerDetails, sdrReceiverDetails, pdfFileNameNew);
if (retVal == 1)
{
SqlDataReader sdrSBLNo = objReports.GetBLNoDetails(cmbContAndJobs.Text, cmbTypes.Value);
string pdfFileName,MBLpdfFileName, pdfFilePath = String.Empty;
Attachment bookingAttachment = null;
while (sdrSBLNo.Read())
{
pdfFileName = "BLDocuments\\" + sdrSBLNo["BillOfLadingNo"] + ".PDF";
MBLpdfFileName = "MBLDocuments\\" + sdrSBLNo["BillOfLadingNo"] + ".PDF";
if (pdfFileName != String.Empty)
{
pdfFilePath = Request.PhysicalApplicationPath + "BLDocuments\\" + sdrSBLNo["BillOfLadingNo"] + ".PDF";
if (File.Exists(pdfFilePath))
{
bookingAttachment = new Attachment(pdfFileName);
AgentPDFDetails.Attachments.Add(bookingAttachment);
bookingAttachment.Dispose();
AttachedPDFFile(AgentPDFDetails, pdfFileName);
}
}
else if (MBLpdfFileName != String.Empty)
{
pdfFilePath = Request.PhysicalApplicationPath + MBLpdfFileName;
if (File.Exists(pdfFilePath))
{
bookingAttachment = new Attachment(MBLpdfFileName);
AgentPDFDetails.Attachments.Add(bookingAttachment);
bookingAttachment.Dispose();
AttachedPDFFile(AgentPDFDetails, MBLpdfFileName);
}
}
else
{
pdfFilePath = Request.PhysicalApplicationPath + pdfFileNameNew;
if (File.Exists(pdfFilePath))
{
bookingAttachment = new Attachment(pdfFileNameNew);
AgentPDFDetails.Attachments.Add(bookingAttachment);
bookingAttachment.Dispose();
AttachedPDFFile(AgentPDFDetails, pdfFileNameNew);
}
}
}
sdrSBLNo.Close();
sdrSBLNo.Dispose();
}
}
|
|
|
|
|
Is this 'C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\BLDocuments\34555.PDF' path correct for you? I think it's getting path of temp projects of VS, I might be wrong.
|
|
|
|
|
Respected,
So, what I will do now.
Thanks
|
|
|
|
|
You didn't answer my question, the path it's giving error is that path for your project ??
|
|
|
|
|
We are developing an application in ASP.NET (Ms visual studio 2008 - .net framework 2.0). There are 4 developers involved in this project and they will work separate nodes. The application source code will be stored one server (Web Server). There no problem while open the solution in multiple nodes, and all of them can modify. We are facing the problem while running the solution in other then server node. This solution is running in only on the server (where we've maintained the source code). In all other nodes showing security related errors.
Error Detail:
The Application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.
Pls help us how to overcome this issue?
Regards,
Rishi
WinCrs
|
|
|
|
|
go into website->ASP.NET configuration ,May that will help u!!
|
|
|
|
|
It is not good to work in this way and No one does like this.
Install TFS to your System and use its console to Check out/Check in files.
I think this would solve your issue.
|
|
|
|
|
Are you all doing development on web server?
Get a source control software and work locally. Once the web site gets into a sort of stable state, deploy that on server.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Thats why I suggested to use Team Foundation System.
|
|
|
|
|
Is Visual Studio Source safe will do that?
WinCrs
|
|
|
|
|
Yes... Both are the same thing.. .
Actually Team Foundation server already has Source Safe in it.
If you just want to use Source Safe you can purchase it(as it will cost less).
But TFS will allow you to do much more than that.
|
|
|
|
|
From where I can download TFS? Is this free version?
WinCrs
|
|
|
|
|
Nope... Its not free. Rather it is costly.
Rather I think if you want to make this cheap, you might Visual SourceSafe 2005. It is cheaper than TFS.
Purchase directly from Microsoft.com. They allow download as well.
Or you can purchase it from your nearby shop.
|
|
|
|
|
Thanks Abishek..
Yes. TFS is around $2000. For me Source safe is better..
Regards,
Rishi
WinCrs
|
|
|
|
|
hello,
i want to know that how can i change image of curent page
image is cange but it show when i page refresh by me.
so what can i do for this problem.
|
|
|
|
|
how you're changing the image?
|
|
|
|
|
i am only upload new image with same name in same page.
|
|
|
|
|
can you show your code please
|
|
|
|
|
Sorry....! i cant because it store in other plase, but the code work properly and image is store also and it change but when i refresh the page not on the button click event.
|
|
|
|
|
What you mean it's stored in other place? If you've done it proper way image should've appeared in first place.
|
|
|
|
|
can you give us some code, so that we can check....
|
|
|
|
|
Sorry....! i cant because it store in other plase, but the code work properly and image is store also and it change but when i refresh the page not on the button click event.
|
|
|
|