|
before we proceed, There are lot of WH here
- what is the requirement
- what is the background
- what about data analysis
- what is table design
- what could be the volumes
- Do you need to implement access permissions
???
Find More .Net development tips at : .NET Tips
The only reason people get lost in thought is because it's unfamiliar territory.
|
|
|
|
|
I am inserting into the database and want to pass the id to the next page via response.redirect but am not sure how to do that.
Here is the code I have:
string custsrc = custsrccode.Text;
string name = custname.Text;
string city = custcity.Text;
string state = custstate.Text;
string postcode = custpostalcode.Text;
string actcode = activitycode.SelectedItem.Text;
string id = labelID.Text;
string activityid = labelactivityid.Text;
OracleConnection conn = new OracleConnection();
conn.ConnectionString = strConnection;
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "INSERT INTO BUYING_ACTIVITY (CUSTOMER_SOURCE_CODE, CUSTOMER_NAME, CUSTOMER_CITY, CUSTOMER_STATE, CUSTOMER_POSTAL_CODE, BUYING_ACTIVITY_CODE, ID) " +
"VALUES (:custsrc, :name, :city, :state, :postcode, :actcode, :id)";
cmd.Parameters.Add(new OracleParameter("custsrc", custsrc));
cmd.Parameters.Add(new OracleParameter("name", name));
cmd.Parameters.Add(new OracleParameter("city", city));
cmd.Parameters.Add(new OracleParameter("state", state));
cmd.Parameters.Add(new OracleParameter("postcode", postcode));
cmd.Parameters.Add(new OracleParameter("actcode", actcode));
cmd.Parameters.Add(new OracleParameter("id", id));
cmd.ExecuteNonQuery();
conn.Close();
Response.Redirect("contractinfo.aspx?Id=" + labelRID.Text);
I get nothing on the labelID.Text when I step thru my code and then when it goes to the next page I obviously get nothing as well contractinfo.aspx?Id="" where the "" should be the id value. How do I fix this with the code I have.
|
|
|
|
|
You read the id from labelID
string id = labelID.Text;
But the ID you are passing on the query string is labelRID
Response.Redirect("contractinfo.aspx?Id=" + labelRID.Text);
If it's the same id use the same label, or just re-use the id variable
Response.Redirect("contractinfo.aspx?Id=" + id);
|
|
|
|
|
I have these fields set to the asp controls below:
string contnumber = contractnumber.Text;
string solnumber = solicitationnumber.Text;
string ordnumber = ordernumber.Text;
string contstartdate = contractstartdate.Value;
string contenddate = contractenddate.Value;
string solstartdate = solicitationstartdate.Value;
string solenddate = solicitationenddate.Value;
string soltype = solicitationtype.Text;
string pasnum = pasnumber.Text;
string commnts = comments.Text;
string contkind = contractkind.SelectedItem.Text;
string conttype = contracttype.SelectedItem.Text;
string ponum = ponumber.Text;
string instrtype = instrumenttype.SelectedItem.Text;
string totcontractamount = totalcontractamount.Text;
string estimloddate = estloddate.Value;
string contfirstname = contractfirstname.Text;
string contmiddleinit = contractmiddleinit.Text;
string contlastname = contractlastname.Text;
string lodsigned = datelodsigned.Value;
string contractid = contractinfoid.Text;
when I open the form to update some of these fields the fields don't update when I step thru the code and obviously don't update using this update statement to the database:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = strConnection;
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "UPDATE CONTRACT_INFO SET CONTRACT_SELECTION = :contractselection, CONTRACT_NUMBER = :contnumber, SOLICITATION_NUMBER = :solnumber, ORDER_SELECTION = :orderselection, ORDER_NUMBER = :ordnumber, CONTRACT_START_PERIOD = to_date(:contstartdate, 'MM/DD/YYYY'), CONTRACT_END_PERIOD = to_date(:contenddate, 'MM/DD/YYYY'), SOLICITATION_START_DATE = to_date(:solstartdate, 'MM/DD/YYYY'), SOLICITATION_END_DATE = to_date(:solenddate, 'MM/DD/YYYY'), SOLICITATION_TYPE = :soltype, SURVEY_REQUESTED = :preaward, PAS_NUMBER = :pasnum, COMMENTS = :commnts, CONTRACT_KIND = :contkind, CONTRACT_TYPE = :conttype, PO_ASSOCIATED = :poselection, PO_NUMBER = :ponum, INSTRUMENT_TYPE = :instrtype, TOTAL_CONTRACT_AMOUNT = :totcontractamount, EST_LOD_COMPLETION_DATE = to_date(:estimloddate, 'MM/DD/YYYY'), FIRST_NAME = :contfirstname, MIDDLE_INIT = :contmiddleinit, LAST_NAME = :contractlastname, DATE_LOD_SIGNED = to_date(:lodsigned, 'MM/DD/YYYY') CONTRACT_INFO_ID = :contractid";
cmd.Parameters.Add(new OracleParameter("contractid", contractid));
cmd.Parameters.Add(new OracleParameter("contractselection", contselection));
cmd.Parameters.Add(new OracleParameter("contnumber", contnumber));
cmd.Parameters.Add(new OracleParameter("solnumber", solnumber));
cmd.Parameters.Add(new OracleParameter("orderselection", ordselection));
cmd.Parameters.Add(new OracleParameter("ordnumber", ordnumber));
cmd.Parameters.Add(new OracleParameter("contstartdate", contstartdate));
cmd.Parameters.Add(new OracleParameter("contenddate", contenddate));
cmd.Parameters.Add(new OracleParameter("solstartdate", solstartdate));
cmd.Parameters.Add(new OracleParameter("solenddate", solenddate));
cmd.Parameters.Add(new OracleParameter("soltype", soltype));
cmd.Parameters.Add(new OracleParameter("preaward", preawardselection));
cmd.Parameters.Add(new OracleParameter("pasnum", pasnum));
cmd.Parameters.Add(new OracleParameter("commnts", commnts));
cmd.Parameters.Add(new OracleParameter("contkind", contkind));
cmd.Parameters.Add(new OracleParameter("conttype", conttype));
cmd.Parameters.Add(new OracleParameter("poselection", purselection));
cmd.Parameters.Add(new OracleParameter("ponum", ponum));
cmd.Parameters.Add(new OracleParameter("instrtype", instrtype));
cmd.Parameters.Add(new OracleParameter("totcontractamount", totcontractamount));
cmd.Parameters.Add(new OracleParameter("estimloddate", estimloddate));
cmd.Parameters.Add(new OracleParameter("contfirstname", contfirstname));
cmd.Parameters.Add(new OracleParameter("contmiddleinit", contmiddleinit));
cmd.Parameters.Add(new OracleParameter("contlastname", contlastname));
cmd.Parameters.Add(new OracleParameter("lodsigned", lodsigned));
cmd.ExecuteNonQuery();
conn.Close();
This is used on a button click event. What am I doing wrong. Is there something I need to do when in addition to setting these fields so that they update when I change them on the form and in the database.
|
|
|
|
|
Did you mean to say "fields", or did you mean "local variables"?
Fields (C# Programming Guide)[^]
Variables and Constants[^]
If you're using fields, you're doing it wrong.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I mean I'm setting the variables : string contnumber equal to the asp form control text box: contractnumber.Text. And then I set those variables equal to the database fields in the update statement to update the database. When I make changes to fields on this form (textboxes, dropdowns,etc.) and click Submit button the fields don't get updated to the database. That's the problem that I need help with.
|
|
|
|
|
Debug the code and watch what is happening. You'll solve it in no time.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I have a dropdown(code is name of the dropdown) that when coming from another page it prefills with a value, the required validator fires off. I have a select statement that fills in all textboxes and dropdowns on this page. When I open this page by itself the validation functions as normal meaning when I select a value from the dropdown no validation and when it is blank it validates. Here is the code for the select statement and reading in the data on page load:
OracleConnection conn = new OracleConnection();
OracleCommand cmd = new OracleCommand();
conn.ConnectionString = strConnection;
conn.Open();
cmd.Connection = conn;
cmd.CommandText = "Select RID, CODE, CUSTOMER_NAME from ACTIVITY WHERE ID = :IDValue";
cmd.Parameters.Add(new OracleParameter("IDValue", Request.QueryString["ID"]));
OracleDataAdapter da = new OracleDataAdapter(cmd);
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
name.Text = dr["customer_name"].ToString();
code.SelectedItem.Text = dr["code"].ToString();
dr.Close();
conn.Close();
I know this has Oracle code in it but it is more of a C#/ASP.net question.
|
|
|
|
|
Bootzilla33 wrote: code.SelectedItem.Text = dr["code"].ToString();
Why are you changing the text of the selected item, rather than selecting the item?
Try:
code.SelectedValue = dr["code"].ToString();
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm not changing the text?? I'm calling that value for that dropdown from the database by using the Select statement.
|
|
|
|
|
Bootzilla33 wrote:
code.SelectedItem.Text = dr["code"].ToString();
That changes the text of the selected item. If you want to select a different item, use the SelectedValue property.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Would that fix my original issue of the validator message popping up even though there is something in the field when coming from a prior page? If that fixes it or you think it fixes it then I will try it.
|
|
|
|
|
Yes, I'm pretty sure that will fix it. Your current code is changing the text of the selected item, which probably doesn't have a value.
NB: You could have tried it for yourself and found the answer immediately, rather than waiting over the weekend for my "permission" to try it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Getting error on bolded line, activitycode.Item(I),Value... if you can't see it.
private void cvactivitycode_ServerValidate(object source, ServerValidateEventArgs args)
{
args.IsValid = false;
for (short I = 1; (I
<= (activitycode.Items.Count - 1)); I++)
{
if (activitycode.Items(I).Value)
{
args.IsValid = true;
break;
}
}
}
What am I missing or need to fix.
|
|
|
|
|
Might not be the answer but you initialise I to 1 in the for loop, should it not be 0?
|
|
|
|
|
The error says you cannot use Items like a method. You used () instead of []. So, change Items(I) to Items[I]. You are not calling the method Items() you are accessing an item in the collection.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Seems like you are aware of VB.NET.
if (activitycode.Items(I).Value)
That is VB.NET way of accessing array elements, in C# that is used to invoke functions. What you need is like this,
if (activitycode.Items[I].Value)
This would work — provided no other errors are raised; is Value of bool type?. For more on this, you can just search for, "array indexing in c# vs vb.net", and also "how to call functions in c#" they will give you a good overview of these features.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I am new to javascript but definitely not new to asp.net development. I was wondering why javascript is gaining popularity among asp.net developers
and what functionalities or features within an asp.net web application it is most often used for ;And also I was wondering is there a particular javascript book that would help me to learn the capabilities of javascript when used with asp.net. Thanks
|
|
|
|
|
There are lots of Javascript books, as there are lots of books on any subject, and Google will find them for you. You can learn Javascript basics quite quickly at JavaScript Tutorial[^].
|
|
|
|
|
You should definitely start with this: JavaScript: The Good Parts[^]
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Patrick Rogers wrote: what functionalities or features within an asp.net web application it is most often used for For any time you do not want to have a full postback of your page. Which could be very often.
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi all,
I need any example or sample application or link anything to develop an ASP.Net MVC Single Page Application using Type Script. Can I write a Single Page application at all using ASP.Net and Type Script, if I can, can somebody please give me an example or sample code etc to help me out. I am new ASP.Net MVC and front-end coding I am more into Middle tier and Back-end coding.
Thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
Even a preciser answer than what Richard gave, ASP.NET Single Page Application | The ASP.NET Site[^].
TypeScript is just a superset of JavaScript, you can use that too, if you know how to use it. If these don't fit for your application, you may also learn the basic SPA template and apply it: Single-page application - Wikipedia[^], basically application just should not reload, it can change the content as required and requested.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Can you provide me an example so that I can maybe reverse Engineer it for my need, I am really poor in MVC, still struggling to connect between front end control with Controller Action, if the application has calls to action methods specially page submits that will help me a lot.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|