I am trying to display a profile page on my website using the SQL Datasource_Selecting and when the page loads I get this error "An SqlParameter with ParameterName '@UserName' is not contained by this SqlParameterCollection."
I have am SqlParameterCollection and an arraylist. I want to be able to loop around both of them and take the SqlDBType of each parameter in the collection, and convert the value of the arraylist to the data type of the parameter.
I've got some textboxes in a panel, that I want to disable client-side upon radio button selection. I've got it basically working - but I discovered that javascript's control.disabled = true still allows the user to type in the textbox. So I've moved on to control.readOnly (in addition to disabled) - that seems to give the result I want.
Problem is, setting readOnly at the panel level doesn't seem to propagate down to the contained controls (the textboxes). I still have to call textbox.readOnly directly in order to get the no-typing-allowed result I need. And this makes the whole panel-concept useless for me in this instance.
Am I doing it wrong somehow, or is this just the way panels work (i.e., can only make textboxes readOnly by directly manipulating its property)?
I'm using panel controls because of the grouping text. I like the clean look this provides for this portion of my form. I don't like the way the panel control works though. I have both the height and the width set in the css file. I also set the background color. The grouping text is set in the mark up of the panel. The problem is that the background color is not contained with in the outline or the grouping text that the control creates. It goes beyond it. To test this I set a border to the panel in the css file. I then set the height and the width for this in the css. When this is viewed in the browser the outline created with the grouping text is no where near the size of the border I created. The border reflects the dimensions of the div. But, the outline of the grouping text and the grouping text itself is more the size of the contents. I assume this is normal for this control. Has anyone had this issue or know how to get around this? How do I get the background color to be with in the panels grouping text and it's outline? How do I get the panel to be the same as the size I set in the CSS?
I have the following setup, but i would like to make the empty text more specific, so just looking to have it display the same message but with the selected value text from the drop down as part of the messages.
so if you select say the 2nd item from the drop down, then i would like to have the empty label(if empty of course) display "There are No Records for Last 24 hrs"
public static int ConceptInsert(string description, string keyword) { int result = -1; string connString = ConfigurationManager.ConnectionStrings["MySpaceConnectionString"].ConnectionString; string commString = "exec dbo.Concept_Insert @description"; using (SqlConnection conn = new SqlConnection(connString)) { using (SqlCommand comm = new SqlCommand(commString, conn)) { comm.Parameters.Add(new SqlParameter("@description", description)); comm.Parameters.Add(new SqlParameter("@keyword", keyword)); conn.Open(); result = comm.ExecuteNonQuery(); } } return result; }
But when I run the code, error message is always Procedure or function 'Concept_Insert' expects parameter '@keyword', which was not supplied. How can I pass those two parameters together to the stored procedure?
I have a <asp:Parameter Name="Person_ID" Type="String" />. My Updatecommand contains, among other things: Person_ID = @Person_ID. That's all fine.
In my code behind, how to I say that I don't want to specify a value for this parameter, but rather want it to use the default value (which in this case is NULL?)
Or rather than telling it to use the Default value, is it possible to set it to Null? I tried setting the value to Null, but the sql code that got generated was Person_ID = "NULL", which of course, is wrong. How do I get it to generate Person_ID=NULL?
I am trying to follow this sample of inserting data through gridview rowcommand. But somehow Im missing the sqlparameter add method whilst the namespace was already added.
Code:
//sqlparameter declaration of list type private List<SqlParameter> insertParameters = new List<SqlParameter>(); mygridview_rowcommand(...){ SqlParameter _prm_guid = new SqlParameter("@pk_guid", SqlDbType.VarChar); _prm_guid.Direction = ParameterDirection.Input; _prm_guid.Value = thisguid; insertParameters.add(?); //error on add() }
Some other part of the code which related to insertParameters variable it give an error
Code: for statement cannot operate on variables of type List<System.Data.SqlClient.SqlParameter> because List<System.Data.SqlClient.SqlParameter> does not contain a public definition of GetEnumerator
how to set sqlparameter list(of sqlparameter ) to a gridview??
Code: Dim l As New List(Of System.Data.SqlClient.SqlParameter) l.Add(New System.Data.SqlClient.SqlParameter("@name", "joy")) l.Add(New System.Data.SqlClient.SqlParameter("@class", "neel"))
Protected Sub FormView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewUpdateEventArgs) Handles FormView1.ItemUpdating Dim IsPresCheck As CheckBox = CType(FormView1.FindControl("IsPrestigeChkBx"), CheckBox) If IsPresCheck.Checked = "True" Then SqlDataSource1.SelectParameters.Add("IsPrestige", System.TypeCode.Int32, 1.ToString) Else SqlDataSource1.SelectParameters.Add("IsPrestige", System.TypeCode.Int32, 0.ToString) End If
but for some reason it's not seeing the parameter and returning an error
I am about to write a method that uses SQLParameter to insert some data into SQL server. However, do I "have" to specify a DBType? If not how is this handled?
Is it possible to create a "drop-in" web service? What I would like to do is create an .svc file that can be placed into a web directory on IIS and accessed (and executed) via its URL, without having to install any other files and without changing any configuration files.I am investigating a possible security problem in a web application that allows uploading .svc files. If it is possible to upload and then execute an .svc file, this would be a big security problem for this application. Unfortunately I am not a .NET developer, so I am probably missing a lot of things here.I know that it is possible to put the service interface and implementation straight into the the .svc file after the "Service Host" directive. Here is my .svc file:
<%@ ServiceHost Language = "C#" Debug = "true" Service = "EchoService" %> public interface IEchoService { [code]....
Now when I access http://localhost/test1.svc I get an exception from .NET: Service 'EchoService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element. I understand that normally you are supposed to configure web service end points in web.config or app.config file. From some Googling I have also learned that it is possible to configure endpoints programmatically by defining your own ServiceHost and ServiceCodeFactory. I have found some examples, but couldn't get them working.I would really appreciate if somebody can either tell me "No, what you are trying to do is impossible, because..." or show how I can add the necessary code to the example above to have an executable service.
Update: using Josh's suggestion I finally got it working. See my answer below for the working code.
I would like an UpdatPanel to update it's content once a button is clicked - this button is contained within a UserControl placed on the webpage.However, I cannot just simply reference it using the AsyncPostBackTrigger's ControlID property, because the button is not situated directly on the webpage.
I have an update panel within it i have my activeX control, below it i have a dropdown that you make a selection from, once you make a selection im trying to pass in different paramters, which really are just the source of the control, since everything else will be the same.. but when i make a selection, the control disappears..
If i remove the update panel and make a selection the control is still visable on the page, at the moment, i dont have much setup, im just trying to get the page layout and framework setup adn working, then i can start plugging in my datasource so actual data is being passed in..
I do have a trigger associated with the updatepanel, but with or without it it still causes the control to disappear..
Just to be clear, it disappearing when i view the page in my browser and make a selection, not within VS. Whats weird is that ONLY that control disappears, the rest of the controls on the page stay visible, the dropdown and buttons.
I have created a simple ASP.NET Website in Visual Studio 2008. I have a static C# class (lets call it someClass) contained in a separate file in the App_Code folder. I call a method from that class in my page's code behind like so:
someVar = someClass.someMethod(someParam);
This compiles correctly in VS 2008 but when I move it over to my IIS server, I get the following error (CS0103): Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0103: The name 'someClass' does not exist in the current context I have created a virtual directory for this website enabling 'Read', 'Run scripts (such ASP)', and 'Execute (such as ISAPI applications or CGI)'. I am not currently utilizing namespaces (as I thought I would not need to and I'm not sure how to use them properly). What am I doing wrong?