You can give any element an id and set it to runat the server:
Then you can access it in your code behind: meta.Attributes("NAME") = "description" meta.Attributes("CONTENT") = "this is my description"
You can give any element an id and set it to runat the server:
Then you can access it in your code behind: meta.Attributes("NAME") = "description" meta.Attributes("CONTENT") = "this is my description"
Add a PostBackUrl property to your button: PostBackUrl="~/Page2.aspx" Then to get the value on your second page: Dim t As TextBox = CType(PreviousPage.FindControl("Textbox1"), TextBox) Label1.Text = t.Text The above only works in .NET 2.0
I know what WSDL is. I am looking for a .NET way to load a web service without a web reference in my project. I know that a WSDL definition will probably be key in accomplishing a dynamic call to a web service but I was unable to find code to accomplish the dynamic call I am looking for.
Is there any way to call a web service without making a web reference in your project or generating proxy classes using wsdl.exe? The project I am working on involves calling a number of web services listed in the appsettings section of the web.config. The app will eventually test these web services for responsiveness. One of the requirements is that it should be configurable from the web.config and should not have to be recompiled upon adding a new web service. I googled a few hours yesterday with little results. Any ideas? Thanks, Scott Stocker
I am currently beginning development for a university project (actually it is going to be my senior design project). Without going into too much of the details, the application I am building will be a custom CMS written in ASP.NET 2.0 (C#). The biggest problem that I have run into is the university does not support SQL or MySQL for a porject such as mine. They have recommended that I use Access for a database. Are there any other options? I noticed that in VS2005 there is an option to add a SQL database file. Could I use a SQL file without SQL Server running? How does it compare to SQL 2005 Server?
Blaming all the wrong that happened on our president is just ignorant. All levels of government failed before and after Katrina - New Orleans didn't evacuate its residents properly (remember the video showing hundreds of school buses submerged in water?), Lousiana didn't send its Nation Guard soon enough, and FEMA failed to coordinate help properly. But lets face it, Katrina is probably the worst natural disaster to hit the US in years and there was no way that any of the help involved could have been completely prepared for such a disaster. You certainly are entitled to your opinion, but next time why don't you try to back it with some facts or opinions that state why you think what you do.
Anders Molin wrote: Why is it that so many people complain about development/evolution of software? Every time MS comes with something new and fancy people go "I Can not afford to develop stuff like that" or "I don't like it, I'm switching to Linux" The orginal point of this thread has been lost in the continual defense of Linux. That wasn't the point! I happen to enjoy working on Linux but the majority of people are comfortable using Windows. Would switching to Linux in a corporate environment really be cheap? Think about it: retrain ALL your employees. I think Vista has some really cool features in it but the fact that most people are not in a hurry to switch from 2000 or XP proves how good those OS really are! Average users don't care what they use as long as it works and they don't have to learn anything new to do their job. -- modified at 14:05 Friday 16th September, 2005
You might want to try searching through the ASP.NET articles, because there is some really good info on datagrids. To get to your question, here is some code to help you get started in building a datagrid dynamically: Create the datagrid (I added my datagrid to a placeholder on the aspx page) protected DataGrid Grid = new DataGrid(); //Properties Grid.DataKeyField = "your field"; Grid.AutoGenerateColumns = false; Grid.CssClass = "Grid"; Grid.CellPadding = 5; Grid.CellSpacing = 0; Grid.AllowPaging = false; Grid.AllowSorting = false; Grid.Width = Unit.Percentage(100); Notice that I have the grid a cssclass. You can control borders and fonts using css, although it doesn't sound like you are too concerned with style at this point in your project. BoundColumn name = new BoundColumn(); name.HeaderText = "Header"; name.DataField = "db column"; Grid.Columns.Add(name) Next, go through the steps you would normally do for a datagrid... //Create the DataAdapter and DataSet SqlDataAdapter dataAdapter = new SqlDataAdapter(SqlString, ConnectionString); DataSet ds = new DataSet(); //Fill the dataset object dataAdapter.Fill(ds,"contractor"); //Bind the data to the DataGrid Grid.DataSource = ds; Grid.DataBind(); Next, add the grid to your placeholder. PlaceHolder1.Controls.Add(Grid); You're done. I'll let you implement that code into a class but the above should be just about everything you would need.
The above method will not work cross-browser (at least not in my experience). Use CSS instead by attaching a class to the textbox and in your css, set text-align: right; to your class. Do it like this: In the CSS: .yourclass { text-align: right; } Hope that helps.
Check the height attribute of your datagrid: Set the height so your last page looks good with only one record. Changing the height should not affect how the datagrid performs on the other two pages. Hope that helps.
It sounds as though you could just use ASP.Net's built in validators - which will do phone number and email format validations for you with no extra code required. Scott Stocker
Here's an easy way to do it: //Allow hitting enter in textbox to submit form Page.RegisterHiddenField("__EVENTTARGET", "YOUR BUTTON NAME"); I hope that helps. Scott STocker
Also note that you can replace the "alert" in the above example with "confirm" to display a messagebox with an ok and cancel button (in the instance that in your messagebox you want the user to confirm an action). Scott Stocker
You are writing an ASP.Net application which CANNOT use the System.Windows namespace. To create a messagebox you can simply use javascript. Here is an example: StringBuilder str = new StringBuilder(); str.Append(""); str.Append("alert('Your Message Here')"); str.Append(""); RegisterStartupScript("Msg",str.ToString()); Hope that helps. Scott Stocker
Datetime doesn't except null values (that is usually how it is set up), so if you want to insert a blank value I believe you can just insert "' '". Let me know if it works. Scott Stocker
Your code is all fine except that you can't set the SelectedIndex to 0. As far as I know that doesn't work. Comment out that line and I bet it will work. Your initial value then will be the first row in your table. Here is an example from some code that I had wrote a while back. Note this is NOT using Visual Studio to assist me: public void buildlocation() { string ConnectionString = "yourconnection"; //Command String string location_cmd = "yoursqlcommand"; SqlDataAdapter dataAdapter = new SqlDataAdapter(location_cmd, ConnectionString); DataSet ds = new DataSet(); //Fill the datatable object dataAdapter.Fill(ds,"yourtable"); location.DataSource = ds.Tables[0]; location.DataTextField = "location"; location.DataValueField = "location"; location.DataBind(); } If you want to initialize a value other than a row in your table do this: location.SelectedItem.Text = "Please Select a Location"; location.SelectedItem.Value = "select"; Hope that helps. Scott Stocker
Do the textboxes have to be on the same page as the datagrid? If they don't there is a much easier way to do this, but for now here's a little explanation for you: As it stands you will have to get the RequestID from the highlighted row and use it do populate the textboxes. It looks as though you have already gotten this ID. If I was designing this page, I put a separate button to load the data into the textboxes. This button can call a LoadData function to fill the textboxes: Here is an example, sorry it is in C#: public void LoadData(string id) { // Connection string for a Text File string ConnectionString = "yourconnection"; // Open the connection SqlConnection conn = new SqlConnection(ConnectionString); conn.Open(); // Create the SQL Command string CommandString = "SELECT * FROM YOURTABLE WHERE RequestID = " + RequestID; SqlCommand comm = conn.CreateCommand(); comm.CommandText = CommandString; // Create DataReader SqlDataReader reader = comm.ExecuteReader(); // Read Data while (reader.Read()) { TextBox1.Text = reader["fieldname"].ToString(); } reader.Close(); conn.Close(); } You can use the data reader to fill the textboxes. I don't believe you will be able to use a DataAdapter as you have probably done for the DataGrid. Everything is pretty straight forward in the code above, but let me know if you need any other help. Scott Stocker
To answer your question about redirect you can do the following: In code behind: private void Page_Load(object sender, System.EventArgs e) { Response.Redirect("http://whatever"); } Or directly in the aspx file in the same manner using As far as trying to access a database, you will have to be a little more specific as far as what you want to do. Are you moving from ASP to ASP.Net programming? Scott Stocker</x-turndown>
I am trying to use custom validation in order to validate certain controls when different radio buttons are checked. There are two radio buttons - when the first one is checked I need to validate location_code and when the second is checked I am going to have to validate four separate textboxes. When the first one is checked, my custom validation is working fine: And here is my javascript function: function location_code(source, args) { if(document.Form1.officelocation[0].checked) { if(args.Value == "select") args.IsValid = false; else args.IsValid = true; } else args.IsValid = true; return; } However, my second custom validator appears to be doing apsolutely nothing. Even when I use the following javascript, nothing happens: function address1(source, args) { alert("hello address"); return; } Does anyone know why my second validator would not be working when it is set up like the first one (which is working)? Does anyone have any other ideas I could possibly use to validate in my situation? Thanks, Scott Stocker