r/ASPNET • • May 25 '13

Another question, Accessing buttons added from inner.html on page_load from page_load

5 Upvotes

'm trying to create an html table with information from my user info table in my database. I've successfully managed to display the information but I'm not managing to add a delete button next to each user (a row in the table).

Basically I've retrieved my whole user info table from the sql database, then I looped through it and added rows and cells inside an already created div (It only has the opening tag because I added a first row for the heading)

I assigned each dynamically create button an ID according to its username and tried to loop through and check if any of the buttons are pressed to remove but Its not triggering.

I'm a beginner and pretty stumped on the right way to do this, I'd be super grateful for any help.

All the code is posted in my stackoverflow question: http://stackoverflow.com/questions/16753339/accessing-buttons-added-from-inner-html-on-page-load-from-page-load


r/ASPNET • • Jan 22 '12

Found this useful when building a RESTful API into one of my projects

Thumbnail
iwantmymvc.com
10 Upvotes

r/ASPNET • • Jun 06 '13

What is the best way to create an Excel file from an HTML table? Not looking for an in depth solution, just a pointer to the right direction.

6 Upvotes

TL;DR: Looking for the best way to create Excel files from an HTML table.

I have a data driven site (built with asp.net MVC 4) that displays a lot of tables to users, and I want to give users the ability to download the data as an excel table.

There seems to be a lot of different options, so I'd like to get an idea of what to check out first before I spend a bunch of time trying all of them.

Some of the options I have seen range from sending the whole table back to server, converting it to XML, then converting to an excel file to recreating the data and then using Open XML SDK to make the excel file.

I have a basic class that creates a SpreadsheetDocument, adds a WorksheetPart, and then adds the data in a Sheets. The big downside to this is that for every page with and HTML table I will have to set up the specifications for how the sheet is built (ie, how many columns and whatnot).

I would love to hear what some of you are using.

Edit: I ended up going with DataTables and TableTools. http://datatables.net/extras/tabletools/


r/ASPNET • • Feb 01 '12

Dynamic ViewState in ASP.Net WebForms - Part 2

Thumbnail
aboutmycode.com
6 Upvotes

r/ASPNET • • Jun 04 '13

What should be upper limits of websites hosted on one IIS server.

7 Upvotes

I am one of the admins for a shared hosting server, and we are trying to evaluate when we should either spin up a new server to split loads, or just throw more resources at the server farm we have.

Anyone have any experience with managing shared hosting environments?


r/ASPNET • • Feb 02 '12

ASP.NET CSV File Export issue

2 Upvotes
            Context.Response.Clear();
            Context.Response.ClearContent();
            Context.Response.ClearHeaders();
            Context.Response.ContentType = "binary/octet-stream";
            Context.Response.AppendHeader("content-disposition", "attachment; filename=FILENAME" + DateTime.Today.ToString("MM-dd-yyyy") + ".csv;");
            Context.Response.Flush();
            

            StreamWriter sw = new StreamWriter(Context.Response.OutputStream); //writes the stream to the HTTP response object.
            sw = ExportResultsToCSV((int)this.assessmentYear_Box.Value, dt, sw); //build our lines.
            sw.Close();

            Context.Response.Flush();
            Context.Response.Close();

So this works fine from the localhost V.S. 2010 debugging, however when the project is moved to a staging/production site the file downloads as expected, but instead of data it is filled wht the markup from the actual page calling the above code. The site is ajaxified, but the button that triggers the follwing statement has been taken out of the ajax cycle, so it is not that.


r/ASPNET • • Jan 31 '12

ViewState Hell

1 Upvotes

I'm fighting and losing a battle with a viewstate bug in my app. The app runs on multiple servers on Rackspace's cloud. The stacktrace for the bug is as follows:

Exception details (if available): System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s, NumberStyles style, IFormatProvider provider) at System.Convert.ToInt32(String value, IFormatProvider provider) at System.Web.UI.Page.get_RequestViewStateString()

Now, I know that Viewstate was created by the devil specifically to try the souls of ASP.NET developers, and I know I should be using MVC. But since I can't fix it permanently at the moment (although it is on the roadmap), how can I get it to quit barfing this error up?

I have not been able to replicate this issue on my dev machine without tampering with the Viewstate _VIEWSTATEFIELDCOUNT field (I figured out that it was this one because of information made available at TypeDescriptor.Net). Anyway, putting a non-numeric value in this field creates an exception with this same stack trace (this is the only place in that function that I'm seeing Convert.ToInt32 being called). So, I'm wondering if this is a hack attempt, browser bug, or something else.

We're currently not doing any gyrations with ViewState. The page on which the error is occurring most frequently does have a metric crap-ton of viewstate data on it - is it possible that the amount of data is causing a browser issue or something?

I've posted the same question on stackoverflow, so if anybody has an answer and wants cred there, you can also hit it at this url: http://stackoverflow.com/questions/9037121/asp-net-viewstatefieldcount-getting-bad-values

I'm just desperate at this point. The fail whale keeps surfacing here, and I'm all out of harpoons.


r/ASPNET • • Jun 24 '13

New to asp.net mvc here.. can I store a view in a variable?

7 Upvotes

Hi, I'm pretty new to ASP.NET MVC, but I use an MVC PHP framework (CodeIgniter) so I get the idea of the MVC architecture.

I took an already started project and I have to make some changes. Naturally I'm trying to apply some things from CI here, and one thing I'd like to do is storing a view (with its dynamic data) in a variable to send it later by e-mail. Is this possible?

I'm having trouble finding a well documented reference of ASP.NET MVC. I go to http://www.asp.net/mvc whenever I need to look for something, but I can't say it pleases me. Are there any other documentation sources out there?


r/ASPNET • • May 21 '13

Beginner questions regarding building data entry form

5 Upvotes

I am building a data management app. I have a gridview populated with records, I want to click on a record to open a data entry form. The gridview is populated by a stored procedure to return search results. Once you click on a row, I want to pass the data key ('ID') to the subsequent page and load up the data in an editable form. What type of object is this? Do I simply build a form and drop a data adapter on the page? I am used to the old-school method of manually building a form with divs and text boxes. Once I have seen the way grids are built in ASP.net, I see things are much easier now and that there should be some different controls I should be using. Can someone offer me some getting started guidance?


r/ASPNET • • Jun 25 '13

Connecting to Oracle Database

4 Upvotes

Hello everyone,

Attempting to configure my Oracle.DataAccess.Client within my .NET application. Had it working perfectly fun, but my Visual Studio imploded and I had to reinstall - since then, it hasn't quite worked. I am able to submit data to the OracleDB, but I cannot visit my page with a Gridview that accesses the DB, and I get an error stating: "unable to find the requested .Net Framework Data Provider. It may not be installed."

Here is what I have done so far:

  1. I have the Oracle.DataAccess reference in my Solution Explorer references.

  2. The OracleDataAccess.dll is within my applications /bin.

  3. I have setup my Connection Strings to access my database (I am positive this is setup correctly as it's identical to the way it was back when this was all working).

  4. My provider name within my Web.Config is: "providerName="Oracle.DataAccess.Client", which seems correct to me.

I'm pretty beginner to this entire asp.net/Oracle setup, so figuring this out is quite difficult. If anyone has any ideas, of any kind, please let me know... it's greatly appreciated.

Cheers.

p.s. If you need more info or anything from me, please tell me so.


r/ASPNET • • Feb 10 '12

EF 4.3 Released. A few new features and bug fixes

Thumbnail
blogs.msdn.com
11 Upvotes

r/ASPNET • • Jun 11 '13

MVC 4 to AZURE

4 Upvotes

Hello,

I have to publish an ASP.NET MVC 4 application on Windows Azure. I have something similar to a free subscription (college project) so there are limitation to what I can do .

I made a Cloud Service and a SQL Database Server with a database. The problem is that i can't connect to the database from my application. I changed the connection string and i tried to run "update-database" but it says my connection string is not good . I alse made a deploy just to make sure... the application is working but it throws an error when i make any kind of query .

I may be setting the wrong connection string... I used the one from the Ado.net section and I used it the MVC project. Do you know any step by step tutorial on how to connect to the Azure DB ?


r/ASPNET • • Jan 15 '12

I need a good recommendation for ASPNET (preferably MVC) blog/cms software

4 Upvotes

I have a WordPress blog and I am just tired of fighting with PHP dev environment + syntax to do simple development work for it. I'd like to replace it all with a C# engine. Can anyone recommend a good starting point? I have done some research but short of installing and trying each one I can't decide how to start. I really just want the simple blog functionality (HTML editing/photo upload/etc) and I will extend it myself as needed. I'd love to hear any success/horror stories about working with the current open source options. Also, I will be starting from scratch so I don't need to migrate any content from WordPress.

Thanks!


r/ASPNET • • Feb 16 '12

.NET CMS Recommendations

16 Upvotes

We're looking at moving away from an Ektron installation (finally). I'm looking at various CMS solutions, with a particular eye to a few things:

  1. Extensible - By far our most important feature. We have a three person team dedicated just to maintaining custom functionality

  2. Support for custom data types - Ties in with the above, but an easy way create real C# POCO's that map to an extensible underlying data model would be most helpful

  3. Strong search / indexing functionality - There is a whole library of media, documents, etc. that need to come over and be indexed for search. Some sort of built in Indexing solution (Lucene, etc.) would be necessary for this. We are completely willing to write the index generation for document types by hand using third party libs to pull content, etc.

  4. Strong administrative UI - Our content authors are not programmers, but they aren't dumb either. We need something that is fairly user friendly. Being able to incorporate our own administrative functionality is also a plus.

  5. Security is absolutely crucial.

  6. Developer support is likely to be a big plus with the customer...

Basically, I'm looking for something that is built to be built upon, rather than something that is looking to be the end-all-be-all solution, but that still offers all the core functionality we need in a fairly nice package.

I'm looking at a few specific ones right now:

  1. Orchard - From what I've seen is built on a stack I like (Lucene, NHibernate, MVC, IoC, etc.). Looks like it has first class support for custom content / data types. Also seems to have some nice built in functionality for providing custom indexing solutions for these types... Not sure on how it handles documents, etc. being uploaded, and figure I'd have to write that part.

  2. Unbraco 5 - The rewrite is MVC based. I see a lot about XML / XSLT when I look at it, which scares me off a bit (Not sure XML storage of custom data / content types would lend itself well to indexing and searching), but I am interested. Any thoughts on this one?

  3. N2CMS - Seems to generate a lot of buzz on Stack Overflow... Seems to be, essentially, a basic MVC site that provides basic CMS functionality for upon which you can build the rest of a solution?

I'm also looking for recommendations on other options. I've thrown out DNN, SharePoint, and a couple of others, but I'm really looking for some ideas on how these would work in specifically to the requirements I have, as without digging through each and building a solution in them, it's hard to see the pitfalls of each approach. The ability for a developer to define some content type (say, a Lecture, or a Calendar event) and for an author to go and fill in some developer created form for this, and for that to all be accessible to be tied into developer created widgets are obviously my core need... I kind of like Orchard's apparent approach to this (representing content type objects in the database the way it seems to...). But also, the indexing capability is absolutely paramount for these custom types as well. I would much rather define these types in code for the customer as POCOs, than having content types be defined via forms in the back end...

Finally, the ability to tie custom created modules / widgets / entire site areas into external applications (in essence, I need the ability to host a UI for a web app inside of the CMS) would also be very helpful... something that it seems I've seen people do in Orchard before, which is why I'm leaning that way...

Anyone have some more informed opinions about a few of these?

Edit: I'm still researching my options, but I think I'm leaning toward either Orchard or Umbraco. Sitefinity looked like an option, but it seems that it might not handle some of our concerns regarding custom content types... N2CMS is still on my list, though I'm a little concerned about just how much we'd have to create ourselves starting there. I'm still going to evaluate it, but I really think Orchard and Umbraco have more out of the box functionality that we need. I think Umbraco might win for our needs, just because the client is going to get giddy about the option for a support contract, though I kind of feel like Orchard is a better fit technologically... I'll update with my thoughts on each one as I install and tinker with them.

Edit 2: I have narrowed our list.

Umbraco - I tried both 5.0 and the 4.7 branch since 5.0 is not really production ready yet. Core functionality was fairly good, but there were several things that were missing... we used a couple of the examples they provide and even installed a bunch of modules to try and build it out closer to what we need, but in the end it just didn't cut it. Content authors weren't too happy about the interface, developers were reminded why we use and IDE to write C# code, and it would not have been as easy as we need to extend a lot of things. Good product for a developer who wants to run his own site, but for a regular user it kind of didn't hold up as a paradigm.

SharePoint - Yes, we had to look at it. I've never had a lot of experience with it, so it was only fair. We support a government agency though, and licensing on SharePoint belies it's other major flaw for us: it's built to be a corporate platform, not just a CMS. The licensing part is that we had to have a license for each user of the system. An "internet version" was available that sidestepped that, but we aren't allowed to use it because this is an internal site. About $8k for our needs, and then you have to buy each user license for $45 on top of that. Ouch.

SiteCore - We have a WebEx with them tomorrow. I know little about them.

SiteFinity - I watched some of their material, and I just can't knock them off. They really seem to have a lot of the stuff down we need. Have a WebEx with them tomorrow as well, and they are currently my lead for non-OpenSource solutions. Our needs would cost us around $8k here.

Orchard - I got my hands into this all day today, and I have to say, I love its architecture. It is exactly what I am looking for... I have to try and sell it to the content authors though next, and I gotta say the admin interface really needs some work. By far, my top choice for OpenSource solution. And it's MVC3 to boot. I'm impressed.

DotNetNuke - I had to include it because it's been the top .NET CMS for a long time. Worked with it back in 4.x and early 5.x days. Thought 5.x was a big improvement but hated developing for it in 4.x, and if not much has changed in 6.x then I doubt I'm going to like it. Not entirely sure it will handle some of the stuff we need in terms of embedding other web apps and such. Have to set up a VM for it real quick this week.

I will most likely be making a decision by weeks end. I kind of feel its going to be between SiteFinity and Orchard. Orchard is closest to the design I need, but SiteFinity has some real pretty user interface design that my authors and designers are drooling over. Plus it has a support contract.

Edit 3: We have chosen SiteFinity for our needs. They offered the closest balance between developer and content author and marketing concerns. You can write a "module" right in the interface, so if you don't want to write the code you can spin up a pretty easy one real quick. Unfortunately it doesn't seem to have the ability to then spit this out into a real code module that you can extend further. Seems to have a fairly decent API. The interface from a content author standpoint is just really good. The fact that you can create new content zones on the fly really raised a few eye brows for our designers and authors. Built in (google) analytics, e-mail marketing campaigns, and the ability to push content between instances (build on one, transfer to another, costs extra) are all nice bonuses.

Orchard is my runner up, but I know I will be using it in the future for something... I really feel they just have the architecture down to facilitate the most extensibility options. Very powerful. But while the base is there for a great system, there are still core pieces missing (publication workflows, interface doesn't abstract away enough of the underlying architecture which makes things harder for non-technicals, etc.). It's a young project still, and while it's completely viable unless you need some specific things. I feel like if we had looked at Orchard a year or two from now, I would have chosen it instead, but it just isn't there yet for our needs.

DotNetNuke still has roughly the same architecture as I knew last version. While it offers a lot out of the box, but I can't forget some of the stuff I had to do when I used to develop for it. In the end, this one is partially personal bias based on experience with the last major version.

In the end though, part of it came down to really being overly impressed with what I've seen of SiteFinity. Telerik nailed the interface here, and that counts for a lot. They also seem to have a pretty good base for extensibility, even extending provider frameworks to override some internal functionality if you want. I didn't see too much in terms of major pain points in terms of development, but I'm sure they will show up at some point. Architecturally it seems like they have implemented a similar design as Orchard for some things... Which may be why I totally think Orchard will pick up some of the design cues and really be amazing in about two years.

For now though, SiteFinity won.


r/ASPNET • • Feb 28 '12

I need ASP.net hosting for a client, but I need 3.5 and not 3.5 SP1. Any suggestions that aren't VPS or dedicated?

3 Upvotes

r/ASPNET • • Jan 23 '12

[ASP/VB.NET] GridView - DetailsView Question

2 Upvotes

I am working on my first ASP.NET web application with SQL server data sources. I am very new to .NET, but have been a VFP programmer for 11 years. I have a basic search engine with a GridView of the results on my main page (Default.aspx). I have the AutoGenerateSelectButton="True" in my GridView. I would like the DetailsView displayed on a subsequent click of the select button (DetailsView.aspx). I am having trouble conceptualizing passing the parameter (my unique identifier is faccode) to the datasource in the DetailsView on the next page. Thanks for your input.

Edit: I know I sound like a complete noob. I have a progress meeting on Thursday and I feel like this.

Edit #2: I got it. I did not have the DataKeyNames set on the GridView, and I did not have a prime key on my table. I added these two line to the SelectedIndexChanged event:

   Dim selectedfacility As String = PFSResultsGridView.SelectedDataKey.Value.ToString()
    Response.Redirect("DetailsView.aspx?id=" + selectedfacility)

Then added my @id on the Page_load of DetailsView.aspx


r/ASPNET • • Jan 12 '12

An approach to mobile support in ASP.NET MVC

Thumbnail
jclaes.blogspot.com
4 Upvotes

r/ASPNET • • May 21 '13

Beginner to Asp.net, need help with server-side validation

7 Upvotes

I pasted all my code on this stack overflow question:

http://stackoverflow.com/questions/16664483/validating-server-side-with-asp-net-and-c-sharp

This is basically my question:

I think i'm doing everything right so far (I'm a beginner in anything beyond html/css) but correct me if I've made any errors.

What I want to do now is validate my form input server-side before I insert it into my database. I want to check that it obeys all my rules, char-lengths, matching fields and so forth - and also that the username/email isn't taken already.

I'm currently doing some basic javascript validation but I understand that isn't sufficient security wise.

an explanation (as simple as possible) as to what I have to go about doing now, would be great. Ideally i would like to return to the signup page and list the errors at the top of the form in a customizable way.

thanks


r/ASPNET • • Feb 28 '12

Good doc on the different State Management options

Thumbnail
msdn.microsoft.com
4 Upvotes

r/ASPNET • • Feb 06 '12

Testing DI bootstrappers

Thumbnail
jclaes.blogspot.com
3 Upvotes

r/ASPNET • • Jan 23 '12

Dynamic ViewState in ASP.Net Webforms using DynamicObject

Thumbnail
aboutmycode.com
2 Upvotes

r/ASPNET • • Sep 19 '13

.net forum software

5 Upvotes

I am looking for forum software written in .net, free or not, that does all of its data access (ms sql) through web services. The network this will be hosted on has the webserver in between two firewalls (DMZ) and the webserver can only access what is called the "app server" which hosts a bunch of web services that have access to the network and SQL servers. I have looked at InstantASP forums and YAF but neither of those have this setup. Any help would be awesome!


r/ASPNET • • Sep 17 '13

Handling Common Casing Issues in .NET using Extension Methods in C# and Visual Basic

Thumbnail
rionscode.wordpress.com
5 Upvotes

r/ASPNET • • Sep 19 '13

Using a drop drop list to navigate paging of a gridview populated by a web service?

1 Upvotes

I'm trying to create a web form in c# asp.net with visual studio 2010 framework 4.0. I take a username and fill a gridview with information pulled from a webservice. From that information, I extract an item to fill another gridview from a different web service. It splits into 15 pages and I would like to add a dropdownmenu to jump to a certain page, but this does not seem to work:

protected void PageList_SelectedIndexChanged(object sender, EventArgs e) { grd3.PageIndex = Convert.ToInt32(PageList.SelectedValue); }

I'm following a tutorial on here-http://msdn.microsoft.com/en-us/library/bb404876.aspx

Any insight would be great, thanks in advance for being awesome!


r/ASPNET • • Oct 01 '13

Tasklist affecting Progress Bar

1 Upvotes

Hi reddit,

I'm making a project management application and have the following tables in SQL that I need to build a progress bar off:

<Project> & <Tasks>

I'm trying to make a page that shows the tasks that are at hand when you click on a project.

That also lists a progress bar with a select Tasks that match ProjectID (from the projectID table) where the state is marked completed.

Any idea on where I can find a guide for a progress bar based on a state of an attribute? (state)

E.g. if I had 3/8 tasks marked as complete the progress bar would be marked 37.5 full...