|
Hi,
Here is my code.
<code>
public partial class SCSFMS_Pages_VisitLog : System.Web.UI.Page
{
Common cmn = new Common();
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
SessionExpiresCheckOnButton();
try
{
hiUid.Text = Session["Usr_Id"].ToString();
hidUtype.Text = Session["UserType"].ToString();
string curdt = System.DateTime.Now.AddHours(13).ToString("dd/MM/yyyy");
string entrydt = cmn.DDMMYYtoMMDDYY(curdt);
txtDate.Text = curdt;
txtVisitDtto.Text = curdt;
if (hidUtype.Text == "A")
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.designationid in (2,4,12) and ud.id=u.usr_id order by UName", "Usr_Id", "UName");
}
string desigid = cmn.nDesgID(hiUid.Text).ToString();
if (hidUtype.Text == "U")
{
if (desigid == "6")
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.id=u.usr_id and (ud.id ="+hiUid.Text+" or ud.admintoreport="+hiUid.Text+") order by UName", "Usr_Id", "UName");
}
else
{
cmn.fillDDL(ddlUser, "select u.Usr_Id,u.UName from users u, userdetail ud where u.status ='Active' and ud.id=u.usr_id and (ud.id =" + hiUid.Text + ") order by UName", "Usr_Id", "UName");
ddlUser.SelectedIndex= 1;
ddlUser.UpdateAfterCallBack = true;
}
}
}
catch (Exception ex)
{
return;
}
}
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
try
{
fillgrid();
}
catch (Exception ex)
{
return;
}
}
public void fillgrid()
{
try
{
string usrsearch = "";
string sqlprt = "";
string desigid = cmn.nDesgID(hiUid.Text).ToString();
if (ddlUser.SelectedValue != "0")
{
usrsearch = ddlUser.SelectedValue.ToString();
sqlprt = "and ud.usr_id = "+usrsearch+" ";
}
lblResult.Visible = false;
lblResult.UpdateAfterCallBack = true;
string myentrydt = cmn.DDMMYYtoMMDDYY(txtDate.Text.ToString());
string mydtto = cmn.DDMMYYtoMMDDYY(txtVisitDtto.Text.ToString());
string sql = "";
if (hidUtype.Text == "A")
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' " +
" " +(sqlprt)+ " group by ud.uname , ov.visit_date, ov.usr_id ";
}
else
{
if (desigid == "6" && ddlUser.SelectedValue != "0")
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' " +
" " + (sqlprt) + " group by ud.uname , ov.visit_date, ov.usr_id ";
}
else
{
sql = " select ud.uname,amt= case when sum(od.prod_amt) is null then '0' else sum(od.prod_amt)end ,totalcall=count(*),visitdate=convert(varchar(12), ov.visit_date ,6) from tblSCSFMS_OrderVisit_Master ov " +
" left join users ud on ud.usr_id = ov.usr_id " +
" left join userdetail udtl on udtl.id = ov.usr_id " +
" left join tblSCSFMS_Order_Details od on od.visit_id =ov.visit_id " +
" where CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) >= '" + myentrydt + "' and CAST(FLOOR(CAST(ov.visit_date AS float)) AS datetime) <= '" + mydtto + "' and (ud.usr_id = " + hiUid.Text.Trim() + " or udtl.admintoreport = " + hiUid.Text.Trim() + ")" +
" group by ud.uname , ov.visit_date, ov.usr_id";
}
}
cmn.fillGridView_By_USP(gdS_AddUser, sql);
if (!gdS_AddUser.Rows.Count.Equals(0))
{
// lblResult.Text = "Search Result";
lblResult.Visible = false;
lblResult.UpdateAfterCallBack = true;
}
else
{
lblResult.Text = "No Data found for the above search criteria.";
lblResult.Visible = true;
lblResult.UpdateAfterCallBack = true;
}
}
catch (Exception ex)
{
return;
}
}
protected void gdS_AddUser_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gdS_AddUser.PageIndex = e.NewPageIndex;
fillgrid();
}
private void SessionExpiresCheckOnButton()
{
try
{
if (Session["Usr_Id"].ToString() == "" || Session["Usr_Id"].ToString() == null)
{
Session["ExpireMsg"] = "true";
Response.Redirect("../../index.aspx?urlvalue1=SCSFMS");
return;
}
}
catch (Exception)
{
Session["ExpireMsg"] = "true";
Response.Redirect("../../index.aspx?urlvalue1=SCSFMS");
return;
}
}
The error it is giving is "Input String is not in Correct Format." to some of my clients. But i havn't received this error yet even on thorough testing of the page.
|
|
|
|
|
try to catch me if you can
some one is eating the exception. If the exception is not re-thrown then there is nothing you can do.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hiya everybody! I need some help trying to find out why is my WS not working as I want it to. I'm newbie when it comes to WebServices.
I got one that helps me get a DataSet so I can work with disconnected data.
public DataSet WSfnGetInfo(string strQuery, string strName, string strClientUser, string strClientPassword)
{
strUser = strClientUser;
strPassword = strClientPassword;
fnCreateCS();
SqlDataAdapter dAdapter = new SqlDataAdapter(strQuery, connString );
DataSet dsInfo = new DataSet();
dAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
try
{
dAdapter.Fill(dsInfo, strName);
}
catch(SqlException ex)
{
System.Web.HttpContext.Current.Response.Write(ex.Message);
return null;
}
return dsInfo;
}
Then I got my client WinApp in which I use this code to show the dataset on datagridview.
myServ.Service myService = new myServ.Service();
try
{
dsMeals = myService.WSfnGetInfo("SELECT * FROM dbo.MEALS", "MEALS", f1ref.user, f1ref.password);
dataGridView1.DataSource = dsMeals;
dataGridView1.DataMember = "MEALS";
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + " " + ex.HelpLink + " " + ex.Data);
}
I can't get to show the data in datset in gridview. I get an error that the "Respons/Answer is not correct XML code". I'm stuck there.
From what I've read, returning DataSet from a WS ain't the best practice due nature of XML WSs and that it is too much text.
Any help is appreciated.
I'm using this as a reference http://msdn.microsoft.com/en-us/library/s5xy331f(VS.80).aspx[^]
|
|
|
|
|
hi,
i am new to this code project.
now am developing multi users login page,
i need some code to develop.
kindly do the needfull.
Thanks in advance.
regards,
lakshmi
|
|
|
|
|
cemalakshmi wrote: i am new to this code project.
Welcome to CodeProject !
cemalakshmi wrote: now am developing multi users login page,
i need some code to develop.
kindly do the needfull.
Buy some beginners Book, start reading and try it yourself. If stuck, then ask here. you will get lots of help other wise not
You can Check Here
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi All,
Do we have a inbuilt function in .Net or DotNetNuke to get the list of countries available. i need to fill it in a dropdown list and i need to avoid webservice which returns list of countries.
Thanks,
Maxy.
|
|
|
|
|
Any reason you can't just hard code it ? I mean, even if the list changes, if you won't call a webservice, it's a hard coded list you're expecting to end up with, right ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
there is no any function in asp.net,you have to search counry list from web, and store in your databse,from there you set datsource tool to fetch up in dropdown list.
i hope you wil satisfy my answer
thanking you
wqqwqw
|
|
|
|
|
|
Please give me link to download visual studio 2005 on my pc.
|
|
|
|
|
bhavna4321 wrote: Please give me link to download visual studio 2005 on my pc.
Why ? google is not working there ? And how does it make sense to put this question in ASP.NET Forum ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Damn - every time I think we've found the stupidest person, someone new comes up. You, sir, are scum. Buy the software, and once you do, please don't come here with your clueless questions, you're obviously too stupid to actually use Visual Studio.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
logon to www.microsoft.com
and search step to download visul studio.
thanks
wqqwqw
|
|
|
|
|
Hello,
Dim vfpConn As OleDbConnection = New OleDbConnection("Provider=VFPOLEDB.1; Data Source='C:\Inetpub\wwwroot\Election\ps5.dbf';") ' is running fine
but,
Dim vfpConn As OleDbConnection = New OleDbConnection("Provider=VFPOLEDB.1; Data Source='http://girish/election/data1.dbc';") 'is returning error (Invalid path or file name.)
vfpConn.Open()
Dim sVfp As String = "select * from ps5"
Dim oCmd As New OleDbCommand(sVfp, vfpConn)
How can i use VFP table as datasource using http://girish/<myapplication folder="" at="" web="" server="">/tablename.dbf ?
Thanks & Regards
Girish Sharma
|
|
|
|
|
perhaps you need write access ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Thanks for your reply.
So, how do i set write access. Please guide me.
Thanks & Regards
Girish Sharma
|
|
|
|
|
Hi,
I have an aspx page that contains a web part and a fileupload control within the web part. I have also added a label that display the status of the upload. I wanted to put the lable inside an Update Panel and then display the correct string value when I click the upload button but I keep getting an "Object is not set to an instance" error. The code for mybutton event looks like this:
try
{
string fileName = fuFileUpload.PostedFile.FileName; (THIS IS WHERE IT FAILS...) string contentType = fuFileUpload.PostedFile.ContentType;
string getFileName = System.IO.Path.GetFileName(fileName);
string userName = Page.User.Identity.Name;
Stream fileStream = fuFileUpload.PostedFile.InputStream;
Byte[] fileBuffer = new byte[1024];
while (fileStream.Read(fileBuffer, 0, fileBuffer.Length) > 0)
{
fuFileUpload.PostedFile.SaveAs(Server.MapPath("UploadedFiles\\") + userName + "_" + getFileName);
}
fileStream.Close();
lblProgress.Text = UploadSuccess;
}
catch (Exception ex)
{
ex.Message.ToString();
}
When I remove the UpdatePanel everything works fine. I then proceeded to wrap the whole wep part within the Update Panel to see if this works and I get the same error.
My question is this, Can you nest a control inside a web part and the web part inside an update panel?
Illegal Operation
|
|
|
|
|
yes you can use webparts inside update panel but not file upload control
actually file upload control requires full postback to work.. i am not sure if any ajax based fileupload control is available....
Government Dyal Singh College Lahore.
|
|
|
|
|
I have an aspx page with jscript in a separate .js file. The page has an autocomplete extender, and I am trying to debug a problem by putting an alert in my EndRequestHandler function. For some reason, it's not executing either the EndRequestHandler or the InitializeRequest functions. It executes OnPageLoad without error, as well as another jscript function hooked to a button click event further south. What am I doing wrong? Thanks for any clues for the clueless.
function OnPageLoad()
{
Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(InitializeRequest);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
return;
}
function InitializeRequest(sender, args) {
alert("You are in the InitializeRequestHandler function.");
}
function EndRequestHandler(sender, args)
{
alert("You are in the EndRequestHandler function.");
if (args.get_error() != undefined)
alert("There was an error" + args.get_error().message);
return;
}
My other signature is witty and insightful.
|
|
|
|
|
hi
i m in mca final year n i have to make a project in asp.net , so please suggest me some good project titles, or sites from where i can download the projects
|
|
|
|
|
vvikram wrote: sites from where i can download the projects
Quit school. MCA is not for you. If you can not perform simple final projects, how are you going to perform your job duties. Go find another job.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Damn - I considered at one point awarding a 'moron of the day' award, but the trouble is, just when you think people can't be stupider, they suddenly are.
I am considering collecting questions like this one, onto my own website, which I will call 'why outsourcing is for morons'
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Sounds like a fun project, just tell us when you get started, I'm sure there'll be a fair number of volunteers.
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
vvikram wrote: or sites from where i can download the projects
Then what is the use of doing final year project ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
I have a aspx page and a user control in it which has a grid. When i click on the edit button in this grid there is a popup opens and i can save data to data base when i hit submit and then on the popupclose i need to refresh just the grid in the user control.
Any ideas how this can be acheived....
|
|
|
|
|