|
Putting something in the value of a control doesn't make that value appear in the Request.Form collection. Request.Form still only contains the data that was sent from the browser in the request.
Also, if the control is in some kind of container in the page, it's client name won't be just "txtUserInfo", but will have the containers name prepended to it.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello,
I need to pass to a function a list of pairs of values.
For each item the first value is a string and the second value is an Enum named Country.
For example, consider I need to pass 3 items:
"New York", Country.UnitedStates
"Paris", Country.France
"London", Country.England
What data type should I use create this?
And how can I access each item inside my function?
Thanks,
Miguel
|
|
|
|
|
For storing one object you can either use System.Web.UI.Pair or a custom class. The former takes two objects, so you must cast them apropriately after getting the value:
Pair p = new Pair("New York", Country.UnitedStates);
String s = (String)p.First;
Country c = (Country)p.Second;
The latter can and should be typed, so no casting is necessary. You just define the members and create properties for them.
Independent from your decision I also know two options, for storing multiple objects. One would be ArrayList, which again takes an object value, so casting is needed. It's still better, then a simple array, beacuse of the variable length.
The second option would be a generic List, but that's only for .NET 2.0. It's typed, so no need for casting. Also you do the typing yourself.
List<Pair> pairs = new List<Pair>();
pairs.Add(new Pair("New York", Country.UnitedStates));
There is a third option for storing your object, Dictionary, which also is a generic (and therefore a .NET 2.0 feature). It is based on key-value pair, where both of them are typed. But you probably don't need that.
|
|
|
|
|
Hi All,
Can any one tell me which control should I use for Date, should I use Calander control or there is a special control for that. I want to provide Search facility to my page i-e
Search FRom Date to Date.
Any Idea.
Thanks in Advance.
|
|
|
|
|
You can use, calendar control or use text boxes and apply validations ( without calendar ). Even if you want to use calendar control, a text box will be needed to display the date.
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
coolestCoder
|
|
|
|
|
Hello All,
I have strange problem in my project .
WHEN I RUN MY WEB SITE THE FOLLOWING MESSAGE APPEAR
"unterminated string constants"
LINE NUMBER : 103769389
EVERY TIME RUN MY PROJECT LINE NUMBER CHANGE TO ANOTHER NUMBER
I AM DO KNOW HOT TO SOLVE THIS PROBLEM .
PLEASE, CAN ANY ONE HELP ME?
ALA QUNAIBI
|
|
|
|
|
Please don't write in all capitals. It's used for the equivalent of shouting, and that is not your normal way of communicating, is it?
How does the message appear? Is it a Javascript error, or is it displayed on the page? Is there any more information displayed than just that?
As you don't have 103 million lines of code, this is probably due to something being interpreted as code that isn't.
---
single minded; short sighted; long gone;
|
|
|
|
|
i am sorry,
but how can i solve this problem?
ala qunaibi
ala qunaibi
|
|
|
|
|
ALAQUNAIBI wrote: but how can i solve this problem?
I have no idea. You have given very little information, and you haven't even answered the questions that I asked. I can't say anything more as I haven't gotten any more information.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi my friend,
- The message appear in dialog box as follows:
Runtime Error has occured
Do you wish to Debug?
Line:103769389
Error: Unterminated string constant.
yes No
- this error is javascript error, and it is not displayed on the page
- there no more more information displayed
- my project not exceed than 10000 lines
|
|
|
|
|
Do you include any Javascript files in the page?
Does debugging give any clue to where the error might be?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi All,
I am developing a WebApplication in Visual Studion 2005 using c#.Net.
I need to find out the Node when I right click on the Particular Node and also the control goes to the new window.I am using TreeView Control in Visual Studio 2005.
How it's
possible?
Thanks,
Jeeva
|
|
|
|
|
I have a LoginControl.ascx control and a ListItems.aspx page. Thay are placed in a MasterPage.master.
I want the login control to be able to handle manual login as well automatic login from reading a cookie.
Depening on the login result the list will display different set's of items.
My problem is that when starting the ListItems.aspx the order of page load is:
1. ListItems_PageLoad (displaying a list of item based on NOT logged in state)
2. Master_PageLoad
3. LoginControl_PageLoad (automatically logging in the user)
This means that the list is displayed on the NOT logged in state and I have to refresh the page to get the correct list.
If I click logout in the logincontrol the list is rendered in the same way:
1. ListItems_PageLoad (displaying a list of item based on LOGGED IN state)
2. Master_PageLoad
3. LoginControl_PageLoad (logout the user)
How should I go about programming to get the result I want?
1. ListItems_PageLoad (Initalize the login procedure)
2. Master_PageLoad
3. LoginControl_PageLoad (loggin out the user)
4. ListItems_PageLoad (complete the load, displaying a list of item based on LOGGED IN state)
What am I missing?
|
|
|
|
|
Use the Prerender event for some of this ( and if you're in .NET 2.0, there are even more events to choose from ), which will allow you to control the order. That is, the Page_load happens before the prerender, so putting something in the prerender, will force it to run later.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thanx for the reply, I think you pointed me in the right direction. I found this article from Vivek Thakur.
http://www.codeproject.com/useritems/lifecycle.asp[^]
From where the page life-cycle-summary is:
1. OnPreInit<br />
2. OnInit<br />
3. (LoadViewState) ONLY ON POSTBACK<br />
4. (LoadPostBackData) ONLY ON POSTBACK<br />
5. Page_Load<br />
6. (recusive Page_Load's for masterpages, other pages, controls)<br />
7. Control Event Handlers (like Button1_Click()) <br />
8. PreRender<br />
9. (recusive PreRender's for mas...)<br />
10. SaveViewState<br />
11. Render<br />
12. (recusive Render's for mas...)<br />
13. Unload
...and from what I can gather, if dependent of the state of user controls placed in a masterpage, I should put the code in prerender as you said. How come all beginner tutorials are so focused on Page_Load then?
|
|
|
|
|
matsnas wrote: How come all beginner tutorials are so focused on Page_Load then?
Because the stupid IDE generates page load and not page prerender methods. The most important thing to understand is that all events happen after load and before prerender, that's another reason that all rendering steps should take place in prerender, so they reflect the results of any events.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if i took web part on mmy page error occured regarding sql server
but whole application runs on another pc without any error having same sql server configuration
|
|
|
|
|
More details about the errorcode would be helpful, you may need to update the Web.Config file to show the complete error message, look at the customError section for more details, if you can post the more detailed information then maybe I can help..
|
|
|
|
|
Check the sql server connectivity. see machine.config for more details on connectionstring which is used for webparts
|
|
|
|
|
hi all,
i am creating a page in asp.net using c#.To insert the data,i just wrote the sql command for inserting and followed the same for edit and update.
for example..
string myinsertQuery = "insert into DriveUnits(SerialNumber,CorporationID,CorporationDivisionID,HWVersion,DateManufactured) values('" + SrNumber_TBox.Text + "','" + Session["corporationid"] + "','" + CorporationDivisionID + "','" + Hwversion_Tbox.Text + "','" + DateMFD_TBox.Text + "')";<br />
SqlCommand myCommand_insert = new SqlCommand(myinsertQuery);<br />
myCommand_insert.Connection = myConnection;<br />
myCommand_insert.ExecuteNonQuery();<br />
myCommand_insert.Connection.Close();
but instead of writing code in cs file,i just want to call a class
so that wherever we need to insert data,we can just call the class and the functions defined.
i created a class and a function and pass parameters.but it is showin invalid arguments..
plz give ur suggestions on creating a class and its functions.
Thanks in advance,
cheers
sangeet
|
|
|
|
|
not sure i got you..
maybe this is what you want..
Using static method.
public class MyDBMgmt{
public static bool ExecuteSQL(string cmdText)
{
return true;
}
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read here. Thank you.
|
|
|
|
|
Is this ASP.NET 1.0, 1.1, or 2.0 ? What errors are you getting ? You should certainly put all your SQL in a class, so that it's in a seperate layer to the rest of your app, and can be reused as needed.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all
i have some code above. I have Some problem when i save this image is type Gif/ JPG so this image show but when i save is PNG is not yet And when i check C:\\demo.Png is Exist and open is ok but on web is not ok. ????
byte[] byImg = objimg.getBytes();
using (MemoryStream objStream = new MemoryStream(byImg))
{
System.Drawing.Image img = System.Drawing.Image.FromStream(objStream);
Bitmap bp = (Bitmap)img;
//Check this image can show
bp.Save("C:\\demo.Png", System.Drawing.Imaging.ImageFormat.Png);
// Show image
bp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Png);
}
|
|
|
|
|
Problem is the format of PNG is not compatible with the Response.OutputStream method directly, you need to store the image in a memorystream at then send that to the browser...
System.IO.MemoryStream memStream;
byte[] bytBuffer;
Response.Clear();
Response.ContentType = "image/png";
memStream = new System.IO.MemoryStream();
bp.Save(memStream, System.Drawing.Imaging.ImageFormat.Png);
bytBuffer = memStream.ToArray();
Response.OutputStream.Write(bytBuffer, 0, bytBuffer.Length);
Response.End();
My C++ skills not good, this is a translation of the VB.NET code that I use..
|
|
|
|
|
Hello all:
I have some question and would like your help.
I have created a page call Login.aspx-The user will login from here.
If login successfully, the user will directed to default.aspx which is my main page.
What I like to accomplish is to have the name of previous logged in person from login.aspx page and display his/her name on the default.aspx page.
How do I go about doing this??
Thank you in advance for your help.
eyungwah
|
|
|
|