C# - Strings Versus Controls In WebForms
Mar 24, 2011
why can images not be appended to a div in asp?
divHtml.append(img);
why do I have to use div.controls.add(img);?
and why cant I add a string to controls.add say like this
div.controls.add(img + String.Format("{0}", reader.GetString(0));
?
Orginally "In the beginning"
I had this code:
[code]....
View 5 Replies
Similar Messages:
Jan 4, 2011
As the title says then the question is relative simple however I cant decide whether a resource file with strings in is better than hard-coded strings...
View 3 Replies
Jul 27, 2010
I understand that MVC can be added to an existing ASP.Net Webforms Web Site Project as explained in this post.
I am wondering if any expert here could tell us what MVC related functions of VS2010 would be missing in this scenario. For example, the very useful shortcuts of "Add View..." and "Go To View" seem to be missing. keep in mind this is about aWeb site project not Web application project so no project file (i.e. .csproj) is involved.
View 4 Replies
Apr 14, 2010
Is there a better way to do "input forms" in WebForms?I always end up with code like this:
Double d = 0; // chuckle inside
if(Double.TryParse(myNumberTextField.Text, out d))
{
myObject.DoubleVal = d;
}
Is there a better way to process free-form "numeric" input.
View 1 Replies
Sep 16, 2010
What is the difference between; Deploying an application Releasing an application Implementing an application
View 1 Replies
Jul 23, 2010
I've gone rounds with this ever since I started programming classic ASP 12 (or so) years ago and I've never found a great solution because the architecture of ASP and ASP.NET has always been a swamp of bad practices, magic shared singletons, etc. My biggest issue is with the HttpApplication object with its non-event events (Application_Start, Application_End, etc.).
If you want to do stuff once for the entire lifespan of an HTTP application, Application_Start is the obvious place to do it. Right? Not exactly. Firstly, this is not an event per se, it's a magic naming convention that, when followed, causes the method to be called once per AppDomain created by IIS.
Besides magic naming conventions being a horrible practice, I've started to think it might be a reason there exist no such thing as a Start event on the HttpApplication object. So I've experimented with events that do exist, such as Init. Well, this isn't really an event either, it's an overridable method, which is the next best thing.
It seems that the Init() method is called for every instantiation of an HttpApplication object, which happens a lot more than once per AppDomain. This means that I might as just put my startup logic inside the HttpApplication object's constructor.
Now my question is, why shouldn't I put my startup logic in the constructor? Why does even Init() exist and do I need to care about Application_Start? If I do, can anyone explain why there is no proper event or overridable method for this pseudo-event in the HttpApplication object?
And can anyone explain to me why in a typical ASP.NET application, 8 instances of my HttpApplication are created (which causes the constructor and Init to run just as many times, of course; this can be mitigated with locking and a shared static boolean called initialized) when my application only has a single AppDomain?
View 2 Replies
Jun 29, 2010
I am developing web-app in .NET for 5 months (and enjoying it =)) and I am reading 3 books, all of them teachs at least 2 methods for acessing data: ADO.NET and SqlDataSource object.
I am used to work with ADO.NET method because I feel that even if it needs coding by hand, I can separate the SQL routines from the page and I can customize database routines better.
For now I am using DataReader mode because the application and the database is on the same server and there is only 1Gb RAM available so there is no advantage using DataSet on this moment.
Am I thinking this right? There are some things with SqlDataSource that I don't know how to do it well...
For example:
I have a routine that inserts a record on a table then gets the ID of this record using SCOPE_IDENTITY() function of SQL Server, than it uses this ID to insert another record on another table. Because I use a one-to-many relationship on multiple tables...
How can I work this situation using SqlDataSource object, is it even possible?
View 2 Replies
Mar 18, 2010
In general, If I have a choice when developing a web site to use html elements or asp.net controls which one is better to use if my website is interactive with server side operations such as accessing database. Is it more secure to use asp.net controls or does not matter.
On other words, is it more secure to use asp.net controls instead of html element to deliver data or receive data from/to server side or no differences?
View 2 Replies
Jan 21, 2010
Which is better from the performance point of view Wizard Bound Controls or Binding Controls by manual ADO.NET Coding?
View 2 Replies
Apr 16, 2010
I need some on techniques to perform page redirect in asp.net. Which one is more recommended to use in asp.net?
Dynamically changed the src of the Iframe to difference aspx.
[code]....
View 1 Replies
Jul 13, 2010
I currently have my access permissions in web.config:
[code]....
This is a very weird one... I just added ASP.NET4 routing, which changes the URLs. So, all of a sudden my web.config permissions are no longer valid! Similar to point #2 above.
I was thinking it would be better to just use PrincipalPermission as security attributes for the classes/c# files involved in each aspx. My question:
More importantly... My PrincipalPermission attribute generates an exception (good) but does not redirect users back to the logon page (bad).
View 2 Replies
Sep 14, 2010
difference between using asp.net validator controls vs JQuery for front end validation? What happens if the user turns off javascript on their browser?
View 3 Replies
Apr 14, 2010
I want to know differences between ASP.Net WebControls and Html Controls (with runat="server" attribute).
I also want to know the possible scenarios where I have to (or want to) prefer Html Controls (with runat=server) in place of asp.net server controls?
In case of some good articles on web, do forward me. But dont forward me the links with differences between webcontrols and html controls, because my question intended for runat="server" attribute.
View 8 Replies
May 26, 2010
I use LinqDataSource and need to make insert not from any data-bound controls like formView (just by pressing button on page).
In SqlDataSource I can set InsertParameters like this
<InsertParameters>
<asp:ControlParameter ControlID="ddlPrice" DefaultValue="0" Name="Price"
PropertyName="SelectedValue" Type="Int16" />
<asp:ControlParameter ControlID="ddlDisc" DefaultValue="0" Name="Discount"
PropertyName="SelectedValue" Type="Int16" />
</InsertParameters>
and then just call Insert().
But in LinqDataSource we don't have method Insert() taking no papameters so I need to create collection with values I want to insert.
View 2 Replies
Jan 14, 2010
This seems like a really silly question, but I've had a search around and I can't find anything about this. I've got a DB connection string that I'm creating in my web.config:-
[Code]....
and
[Code]....
but I need this connection to be read only. I've defined all my linq objects with only gets on their properties, and none of my (MVC) repository classes have .SubmitChanges() methods in them so I'm 99% sure the system can't update this DB, but I would also like to set my DB connection to be RO if at all possible. I realise that ideally this should be done at the SQL server end and the user should be made RO, but that (for various reasons, out of my control) can't be done, so I wanted to lock down my connection as the app mustn't write to the DB.
Is there a "readonly" parameter I can apply to the connection string so that it would throw an error or discard the data if any updates were attempted?
View 8 Replies
Feb 11, 2010
Anyone know if it's possible to inner join tables using two different connection strings? I'm using vb.
View 3 Replies
Apr 10, 2010
I'm writing a sql query for my database, that goes:
comn.CommandText= "INSERT INTO tb1 VALUES(' " + textbox1.text.tostring() + " ',' " + textbox2.text.tostring() + " ' )";
Which works great until one of the characters in one of the textboxes is ' (apostrophe).
View 3 Replies
Jan 18, 2010
1. I know about collections but I dont remember the precess. I know you drag a sqldatasource control on the form(Select everything in the database ie. selct *) and then delete it. But how do I use it i code.
Example. I need to select services where country=canada from the Agencies table.
2. I know how to manually pull data from an access database using the code below. I want to know how to pull data from a sql database just like the one below.
3. explain the difference between Collections and manually pulling it like the one bellow?
<code>
<script>
Stringpath = Server.Mappath = Server. MapPath(/website");
String connStr = Provider=Microsoft.Jet.OLEDB.4.0" +"DataSource="+path+
\Database;
OleDBConnnection conn = new OleDBConnection(connStr);
conn.open();
OleDbCommand cmd= new OleDBCommand();
cmd.COnnection = conn;
cmdCommandText = "Select * From [Suppliers];
OledbDataReader dr= cmd.ExecuteReader();
Response.write(dr.getvalue(1);
View 1 Replies
Jun 8, 2010
I have a drop down with different domains(domain_id column) and a textbox (TextBoxComment) for comments. What I am trying to do is select the area, input a comment, click the button and have it save to the db. My connection string errors on compile.
[Code]....
View 8 Replies
Jun 16, 2010
I have a similar problem. I have one Dynamic Data Website and a thousand databases - one database for each customer. HTe databases have the same schema.
After the users log in I want the Dynamic Data Website to point to a database that belongs to that user.
View 2 Replies
Jun 4, 2010
or on one sql statement in VS 2008.
How to use two connection strings on one data adapter
View 3 Replies
Oct 20, 2010
I have a GridView with a couple of buttons (asp:Button) in it (last row). Both of them have a CommandName attribute on them and this is handled server side in a grid_RowCommand event handler. Now, this works fine. However, I need to add client side code (Javascript/jQuery) to disable the two buttons when someone clicks on or the other. This is to prevent the user from double-clicking and creating potential havoc.
The way I have done this is by adding OnClientClick on both buttons which calls a javascript function that uses jQuery to disable the two buttons. This works fine, it's just that the page doesn't post back and so the RowCommand event handler never fires.
[code]....
View 2 Replies
Sep 23, 2010
in the selected event it seems even though e.TotalRowCount really is the total row count, when I cast e.Result to a type in order to access the actual data only the current page of data is there? not all.
IEnumerable<InventoryGridItem> items = (IEnumerable<InventoryGridItem>)e.Result;
items only has the 15 records for the current gridView page, not all the records, is this normal? If I need to access all the items in the result do I need to stick with the selecting event instead?
View 2 Replies
Jan 19, 2010
I've got the following ListView (extra code removed for clarity) :
<asp:ListView ID="lvParticipants" runat="server" DataSource='<%# Eval("Participants") %>' >
<ItemTemplate>
<asp:Label ID="lblHomePhone" runat="server" Text='<%# Eval("HomePhone", "{0:(###) ###-####}") %>' ToolTip="Home" />
</ItemTemplate>
</asp:ListView>
This does render the phone number, but it is unformatted (8005551212 instead of (800) 555-1212).Why is the formatting not applied?
View 9 Replies
Nov 25, 2010
Is it possible to display strings in a CheckBoxList? I want to display different options that I fetch from a database and display the options as strings in a CheckBoxList where the user can choose one option (maybe I should use a RadioButtonList?).
View 10 Replies