I am working on a page whereby all the controls within the page get translated to another language.
This is handled within the master page prerender event and generally works fine.
However my page consists of a multiview control that is made up of 2 views. By default the INSERT formview is displayed so the user can enter form detials. This translates fine.
On clicking the save button the multiview active index is set to 1 and the EDIT formview displayed so as the user can update any of their details. This view does not get translated.
It would seem this is due to the controls not being available at this point in the page cycle or when this button event fires.
So i opted to do the translate process within the prerender event of the EDIT formview, and the method does have access to all the controls within this formview and runs after the master page prerender event. So all should be good.
However it seems that all th epage properties at this point in time are cleared. So the translation doesnt work. At the point of master page prerender i have verified they are populated with the values, but as soon as i hit the formview prerender all the page properties get cleared to nothing...
I'm trying to implement URL Rewriting into my existing application and have managed to get the page and links working except that my destination page does not get the query string values.Mycde is based on the example below: http://dotnetguts.blogspot.com/2008/07/url-rewriting-with-urlrewriternet.htmlBasically I have a default.aspx page with links to another page; directory_item.aspx?Item_Id=1&Category_Id=1 directory_item.aspx?Item_Id=2&Category_Id=1 and so on... The code in my web config is as follows;
When I open an ASP.NET 3.5 project using VWD2010, I get a prompt error message,"The connection property in the web.config file is missing or incorrect.The connection string from the .dbml file has been used in its place."however, my project works successfully.
I am trying to get my head around the ASP timer control. What I am trying to achieve is to get a page to reload every 60 seconds but change the url querystring everytime between 3 values
i.e. scroll through server/page.aspx?value=1 server/page.aspx?value=2 server/page.aspx?value=3
how I have though to do this is to use ASP code to grab the querystring value, and then create the next url. But I am having trouble passing that newly created url to a refresh control. im guessing HTML meta refresh is out of the question as I am using a variable. So from what I can see my option is to use the ASP timer control to count down (after the page has loaded) and after 60seconds load the next url.
The user control has public properties named accordingly and the page has protected properties accordingly which I've verified have the desired values.
For some reason the values are always empty strings or 0s in the usercontrol, no matter what the page property is.
I have several controls on a page that I want to bind the enabled property to a couple of properties in code behind that are set on Page_Load. Here's an example of what I'm using to bind to the properties.
This works fine once the page is posted back for the first 4 controls on the page.Here's the 1st control that doesn't get disabled like I expect it to. The expression is the same in the Enabled property so I'm not sure why it isn't working.
Can we write property in property?IN the page load event we have page property and we can find another page property in that page property.Pls let me know how this is happening
When I add a user control which has bindable properties to an asp.net page I do not see its bindable properties on the designer's dialog box when I click the edit Data bindings on the Repeater-Listview
Code: Imports System.ComponentModel <System.ComponentModel.DefaultBindingProperty("Text")> _ Public Class UserControls_ucSpecialTextBox Inherits System.Web.UI.UserControl ... <EditorBrowsable(EditorBrowsableState.Always), _
public void SomeFunction(string searchField) { var data = from a in dx.SomeTable where [code]...
Now if I had to use the value of the parameter "searchField" as the property to be selected in the where clause then how do I do it ?
i.e I want to assign the value of the parameter "searchField" to the property I am checking in the where clause.
So ... the value of "SomeProperty" in a.SomeProperty must be the value of "searchField". How to do this ?
PS : I dont want a.SomeProperty=searchField. What I want is "SomeProperty" itself to be replaced by the value of "searchField" and then , this has to be checked to see if its equal to 270.
I have a class Person that represents a person in my database. This class has a CategoryId property (int) and a Category property (type Category).
Category is a class that represents a category in my database. csharp Code: public class Person{ public int Id {get; set;} public string Firstname {get; set;} public string Lastname {get; set;} public int CategoryId {get; set;} public Category Category {get; set;}} public class Category{ public int Id {get; set;} public string CategoryName {get; set;}} [code].... I am displaying a list of these Persons in a GridView, and I would like to display the name of the Category (the CategoryName property to be precise). So I define this markup;
Usually I would solve this problem by one of two ways:Override the ToString method of the Category class and return the name. Add a readonly 'CategoryName' property to the Person class, where I return 'this.Category.CategoryName' (and then bind the column to this property instead).
In this case however, I am using the Entity Framework, and the Person and Category classes are automatically generated by the database model. I suppose I could edit the generated code manually, but I don't like that, since any change in the model will cause VS to re-generate the code and my changes would be lost. So these two methods are not going to work...
The simple question remains: how do I make the Category column show the CategoryName property of the object it represents, rather than just the type name?In a DropdownList for example (which I am already using for the user to select a category when creating a person), I can set the DataTextField (to "CategoryName") and DataValueField (to "Id") properties and it displays the right name and uses the right value (the Id). I can't find anything similar for a BoundField though... Am I overlooking something obvious?
Another solution would be if I could tell the Entity Framework model to add another property to my Person class which returns the CategoryName of the Category. I can't find any way to do that though (I am a compleet noob in EF),
Dim cmd As New SqlCommand cmd.Connection = New SqlConnection(<connectionString here>) cmd.Connection.Open() cmd.CommandText = "Select * From table_name" Dim da As New SqlDataAdapter(cmd.CommandText, cmd.Connection) Dim ds As New DataSet da.Fill(ds) ' I want to do some query with THIS dataset cmd.Connection.Close()
I want to do a query based on the dataset ds. Let's say I want to filter out names that starts with "a". If yes, how do you do it?
I have a SQL query I'm running in an ASP.NET page. The final parsed SQL needs to contain a list of string values in the WHERE [columnname] IN [values] format. For example, the final query might look something like this:
SELECT PRODUCTNAME FROM PRODUCT WHERE PRODUCTCODE IN ('ABC','DEF','GHI','JKL', /* etc */);
However, the string values in the WHERE clause need to be dynamic. Normally I use parametrized queries to make my code convenient and safe, so conceptually I'd like to do something like this:
String[] productCodes = { "ABC", "DEF", "GHI", "JKL" }; SqlCommand cmd = "SELECT PRODUCTNAME FROM PRODUCT WHERE PRODUCTCODE IN (@ProductCodes)"; cmd.Parameters.Add("@ProductCodes", productCodes);
However, this sort of functionality doesn't appear to exist in .NET. How should I go about implementing this? I could use a foreach loop on the array and run a query with a single value as a parameter for each value, but there could potentially be a hundred or so different values in the array and it seems like querying them separately would be very inefficient.
I've read another question where someone suggested a solution for strongly-typed int parameters, but that method would make me nervous about SQL injection when used with String values, especially since the client may very well be able to influence the input values.
I'm new to linq. here is the scenario i need to write query for.I have a "Candidate" table with a varchar property "Skill"I have the table OR-mapped with LINQ to SQL on dbml file. Now I want to write linq query that:Selects all Candidates that have skill containing any of the keywords from ("asp.net","php","java")
which datatype is needed if I want to display the data 1 / 2010 and want to get query = select min (number) as number. Do I have to use a separate number and year?
Here's something I've been stuck on for some time. I used code from the ADO.NET Tutorial and tried to translate it so it applies to SQL and the database on my website. I set the Configuration Manager for Debug and so I can see a detailed error message.
I have most of the lines in the DoStuff Sub commented out right now but I get the same error message either way so it's responding to the first line below Try.
Here's the error message I see. Line 52 is : da.Fill(ds)
The table in Database1 that I'm trying to access is called Ray Rover Activation.
I have an application where I am trying to create a Content Management System for a set of newsletters. I use a SQL server to store all content, and have the connection string in the Web.Config. I use forms to allow users to enter articles and register to receive the newsletters. The app regularly generates the newsletters and emails them out. Since the processing of the newsletters does not need a form, I was considering using a class.
I am having trouble getting the datasets connected to the SQL database, and using the stored connection string. I am thinking it is something like:
Code: Imports System.Data Imports System.Data.SqlClient Public Class clsProcessNewsletters Dim strSql As String = "SELECT * FROM Users" Dim dtb As New DataTable
[Code] .....
First of all is this an appropriate approach? And if so, any pointers on cleaning up the code?
In the original site, master page has code-behind to check a query string parameter value. Depending on this value, code-behind dynamically modify some CSS property to hide / display master page elements.
As MVC2 has no code-behind because we are supposed to perform everything in the controllers, how should I proceed in this case ?
I see this : [URL]
It partially answers my needs but the query string processing is common to all pages. How can I move this processing in a common code section ?
I have a custom control that inherits from .NET's CompositeControl class. This control overrides the CreateChildControls in order to build its child controls dynamically. I need the page to post back after a couple different javascript events occur on the client side.
In order to accomplish this, I create two hidden controls on the page so I can set their values with javascript, submit the page, and read the values out on server side. Here's is the code I use to create these two hiddens:
I have added a linq to sql layer in my MVC 2 application.
This is the code I am using:
using (ProductPortalDataContext ctx = new ProductPortalDataContext()) { var Title = from aps in ProductPortal.Models.AppSettingsView[code]...
It says to be unable to find a quey model for AppSettings view and then says "where not found".
Tried googling, nothing came up. Tried searching here(first two pages) and nothing that seemed relevant popped up.But the best of all, created a new ASP.NET applicatio, imported the model using Linq to SQL and it compiled!Ok, I tried adding a button and a label to the asp.net application just to see if it would work... guess what? It doesn't!Still the same error message and I have *NO* clue what's wrong with it!
I have a dropdown list which provided input to a SQLDataSource query which is bound to a listbox. When the user changes the index of the dropdown box, I want to trigger the SQQLDataSource to requery the database, and repopulate the listbox.
I have set the autopostback = true for the dropdown box. I have also added a Response.Redirect back to the same page in the SelectedIndexChanged method, but the DataSource does not Repopulate. How to trigger the requery?
I'm tyring to write a simple DetailsView only used for inserting new records that will pre-fill a textbox with a query string value. Here's the DetailsView:
[code]....
All I want to do is set VenueID_FK.Text to = the "VenueID" querry string. I also want the user to be able to see the VenueID number as they are filling out GridView1.
I know this is probably a simple thing, but I am very new to asp.net. I thought I could handle this in the page load event, but when I try something like this
And then follow by setting the Text property programitically. I've accomplished something similar to this on a different page using a FormView, but only for ReadOnly mode and it was handled in the databound event on that page.
I get the error "The name 'DetailsView1' doesn't exist in the current context." when trying to do the above mentioned. When trying the same line in the databound event here, I get the same error.
I have a array list and am using like a database trying to search for ChildID and ParentID based on certain criteria.
My example below has the following keywords to search for:
Yellow, Mustard, Honey, Orange, Flame, Talisman
I also have a category volume value which I grab the first 2 characters to determine another filter.
My code isn't returning all matches with using 'Contains'. Right now it finds the 'Orange, Flame, Talisman'/AV record and returns 50, 28. My keywords also has 'Yellow, Mustard, Honey'/AV which should return 55 and 28 as well.
HTML Code: <%@ Page Language="VB" AutoEventWireup="false" CodeFile="temp2.aspx.vb" Inherits="temp2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">