|
few weeks ago i was learning from this article
Dynamically add and remove user controls[^]
this article is great but its work with except when try to remove the user control i want to remove this part of code
public void HandleRemoveUserControl(object sender, EventArgs e)
{
Button but = sender as Button;
WebUserControl DynamicUserControl = (WebUserControl)but.Parent;
ph1.Controls.Remove(DynamicUserControl);
ltlRemoved.Text += DynamicUserControl.ID + "|";
ltlCount.Text = (Convert.ToInt16(ltlCount.Text) - 1).ToString();
}
this is the code in C# , but the original exercise was in VB , am idiot in VB , did i convert it wrong , and if someone can help me and tell me how we write C# code to determine wich user control fired event
this is the original one in VB
Sub HandleRemoveUserControl(ByVal sender As Object, ByVal e As EventArgs)
'This handles delete event fired from the user control
'Get the user control that fired this event, and remove it
Dim DynamicUserControl As WebUserControl = sender.parent
ph1.Controls.Remove(sender.parent)
'Keep a pipe delimited list of which user controls
'were removed. This will increase the
'viewstate size if the user keeps removing
'dynamic controls, but under normal use
'this is such a small increase in size that it shouldn't be an issue.
ltlRemoved.Text &= DynamicUserControl.ID & "|"
'Also, now that we've removed a user control decrement
'the count of total user controls on the page
ltlCount.Text = Convert.ToInt16(ltlCount.Text) - 1
End Sub
|
|
|
|
|
Try posting your question in the forum at the end of the article then the author will get a notification of it.
The best things in life are not things.
|
|
|
|
|
hi,
i am using LINQ to get data.on this line i am getting error
var comps = from com in cox.Companies where com.ActivityId == id
select com ;
return comps.ToList<company>();
can any one help me?
|
|
|
|
|
You problem is likely that ActivityId and id are different data types (one is Decimal and one is String). I'm guessing id is a string. Convert it to a decimal before using it. For example:
decimal idVal = decimal.Parse(id);
Or if you need to do the reverse, you can use ToString:
string idStr = id.ToString();
|
|
|
|
|
No i check it again...my Id = int32 and ActivityId is int.
|
|
|
|
|
Perhaps the LINQ model and the database are no longer the same (e.g., if the database was changed from int to decimal). Make sure bot the ActivityId in the model and the one in the database are the same type.
|
|
|
|
|
Also, if you have a full stack trace at the time of the exception, that would be useful to see.
|
|
|
|
|
hi all
i want to debug the javascript function in asp.net
is it possible, if yes then how.
thanking you
Vijay Kumar D
|
|
|
|
|
Yep. You may need to use Visual Studio 2010 (rather than VWD Express). I think VWD has debugging, but you can't do certain things (IIRC, I had problems setting breakpoints, so I just threw errors where I wanted a breakpoint to be).
Also, make sure JavaScript debugging is enabled in Internet Explorer. Create a new Web Application and toss some JavaScript in it and you should be able to start debugging (e.g., make a statement that will throw an error and Visual Studio should stop on that line of JS).
|
|
|
|
|
Hi Vijay
Debugging java script in asp.net mostly depents on client side utilities.
first it depends which browser and asp.net technology(1.1, 2.0, 3.5 or 4.0) you are using.
in asp.net 3.5 you can get new features like Trace using ajax extension and also various browsers supports javascript debugging such as in Mozilla you can use firebug, in Safari there is developer's tag and internet explorer better works with ajax trace.
just go through this utilities and ajax extension (if using framework greater than 2.0). this will definately work
Thanks
Ankur Sharma
|
|
|
|
|
|
Hi,
While getting the good stuff at work, my own weekend-company uses the Visual Express editions to get things working. Lately my devmachine crashed and I thought I wanted to use the occasion to "fix" some of the network items on the list. So now I have a database box, a testmachine and a devmachine. But here it comes. When I want to install VS2010 express on my devbox, it seems that MSSQL Express is mandatory. How do I install VS2010 Web without the SQL server?
Any ideas? Thanx in advance!
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
Helfdane wrote: it seems that MSSQL Express is mandatory
Then I'd say there is no way around it. But you can try. At what point did it seem mandatory... what UI did you see and what message did it say? First, I'd say download the ISO that contains everything except for SQL Server. Maybe that will give you an option to install without SQL Server (though you may be required to install SQL before you can run VWD Express... not sure).
You might also see what they have to say here, though I'm not too clear exactly what they mean. You could give it a try if the ISO approach doesn't work.
|
|
|
|
|
I downloaded the MS Web Platform Installer. When I select Visual Web Developer Express, it say's "okay, fine, but you also need SQL 2008R2 Express, Sql2008 R2 Management Tools, SQL Server Native Client, SQL2008 Server System CLR Types, SQL 2008 Server Compact 4.0, Tools for SQL 2008 Server Compact 4.0, Tools for SQL 2008 Server Compact Installer 4.0 and Tools for SQL 2008 Server Compact Installer New Installations 4.0."
And there is no way to unselect them. This would only bog down my dev machine by installing/running this all...
[edit]The link you provided has given me Visual Studio 2010 alright, but not the version which can create web applications, only windows forms allowed I appreciate the help though.
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
modified on Friday, May 20, 2011 4:08 PM
|
|
|
|
|
Helfdane wrote: The link you provided has given me Visual Studio 2010 alright, but not the version which can create web applications, only windows forms allowed
The first link I gave you has many things listed for download, including: "This ISO image file includes: Visual Basic 2010 Express, Visual C++ 2010 Express, Visual C# 2010 Express, and Visual Web Developer 2010 Express."
Helfdane wrote: When I select Visual Web Developer Express, it say's [...]
Yeah, I saw that in the WPI download portion. I wonder if an installer will launch and give you the option to avoid installing SQL Server. I am not sure. That is why I recommend you download the ISO... so you don't have to worry about the WPI.
I wouldn't get your hopes up though... SQL Server may just be a required dependency. You could perhaps hack the registry to make the installer think SQL Server is already installed, but there's not telling what kind of havoc that would cause.
|
|
|
|
|
unless you are running a pretty low machine, installing the SQL stuff just to get VS to work should not really bog down anything. Not actually using it and letting it just ride there to make VS happy and getting bogged down by it would suggest you just need a better machine as its not very resource intensive in that state. I have run the full version on some pretty low end Dell towers in the past with no trouble at all.
Just my opinion.
Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning.
|
|
|
|
|
I do recall, when I downloaded and installed VS2008C# Express, I was asked whether I also wanted (1) SQL Server Express and (2) SilverLight. I don't recall the details for VS2008 WebDev Express.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
When you create a ContentPlaceHolder in a masterpage, you can place some default content in it and then you can overwrite that content in a subpage or sub-masterpage. However, if you try to overwrite that content in a subpage of a sub-masterpage of the masterpage, you get an exception ("Cannot find ContentPlaceHolder 'body' in the master page '/SubMaster.master'"). You can fix this by copying the content in the masterpage and putting it in the sub-masterpage. However, that then requires that any change done to the masterpage also needs to be done to the sub-masterpage. I am curious if there is a way to avoid that. As an example, suppose I have this masterpage:
<%@ Master %> <%----%>
<html>
<head runat="server"><title></title></head>
<body>
<asp:ContentPlaceHolder runat="server" ID="body">
<p>MainMaster text.</p>
</asp:ContentPlaceHolder>
</body>
</html>
It defines the "body" ContentPlaceHolder . Then I have a sub-masterpage:
<%@ Master MasterPageFile="~/MainMaster.Master" %> <%----%>
<asp:Content runat="server" ContentPlaceHolderID="body">
<asp:ContentPlaceHolder runat="server" ID="body">
<%----%>
<p>MainMaster text.</p>
</asp:ContentPlaceHolder>
</asp:Content>
I then have two pages that use that sub-masterpage. The first one overwrites the ContentPlaceHolder :
<%@ Page MasterPageFile="~/SubMaster.master" %> <%----%>
<asp:Content ID="Content1" ContentPlaceHolderID="body" runat="server">
<p>Page 1 text.</p>
</asp:Content>
The other page inherits rather than overwriting the ContentPlaceHolder :
<%@ Page MasterPageFile="~/SubMaster.master" %> <%----%>
<%----%>
The real web application uses a much more complicated setup than this example, so I'm not looking for suggestions like "just get rid of the sub-masterpage". What I'd like to know is if there is a way to make that content from MainMaster propagate down to Page1 and Page2 without redefining the same content in SubMaster while allowing Page1 to overwrite the content and Page2 to keep the content intact. Note that the content in MainMaster may itself have some ContentPlaceHolder s, so using a user control to contain the content isn't a workable solution.
|
|
|
|
|
I have been given the task to upload a few large files in a new project. Files sizes will be no more than 200MB.
I have been doing my research on the best approach to uploading these files to the server.
I was just wondering if anyone out there has tried to implement something similiar and has any advice to give?
Ideally I would like to split the file into seperate files to upload and then re-combine on the server.
Any comments are greatly appreciated.
ASP all the way
|
|
|
|
|
My 2 cents:
1) Maybe implement the solution using FTP. Have your client use FTP to a predtermined location and process it from there.
2) Investigate 3rd Party controls that are designed specifically to upload large files.
Good luck.
|
|
|
|
|
Thanks David,
These are the kind of solutions we have been looking into.
Thanks for your input much appreciated.
|
|
|
|
|
in your web.config file state:
<httpRuntime maxRequestLength="300000"/>
this line is placed in the section:
<system.web>
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
i build one project . i have 1 error
this is track error
<br />
Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.<br />
<br />
Source Error:<br />
<br />
Line 50: <authentication mode="Windows"></authentication><br />
Line 51: --> <br />
Line 52: <authentication mode="Forms"><br />
Line 53: <forms loginUrl="Login.aspx" timeout="10" ></forms><br />
Line 54: </authentication> <br />
I do not bring my project to IIS that I run it in Visual Studio 2010
how to fix the file web.config
|
|
|
|
|
Do you have Global.asax in your application..?? are you doing "Server.ClearError();" anywhere for exception handling..??
|
|
|
|
|
have you defined an authentication tag in the web.config of a folder inside the root ? The authentication tag can only exist in the root web.config
|
|
|
|