|
Hi, I am generating reports in my ASP.Net MVC Web application by using ReportViewerForMvc tool, I am able to generate them locally on my machine by using the code below.
public ActionResult ShowLegalEntityReport(string legalEntityNumber, string lENumOperator, string legalEntityName, string lENameOperator
, string taxId, string taxIdOperator, string submittingCounty, string submCountyOperator, string legalEntityCity, string lECityOperator)
{
ReportViewer reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.SizeToReportContent = true;
reportViewer.Width = Unit.Percentage(900);
reportViewer.Height = Unit.Percentage(900);
DataRetrieveServiceClient drsc = new DataRetrieveServiceClient();
DataTable dt = CommonFunctions.ToDataTable(drsc.GetLegalEntityReport(legalEntityNumber, lENumOperator, legalEntityName, lENameOperator, taxId, taxIdOperator
, submittingCounty, submCountyOperator, legalEntityCity, lECityOperator));
reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Reports\LegalEntityReport.rdlc";
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("LegalEntityDataSet", dt));
ViewBag.ReportViewer = reportViewer;
return View();
}
To run it on the Server I have used the following change but the report generation fails locally as well on my machine:
reportViewer.LocalReport.ReportPath = Request.ApplicationPath + @"/Reports/LegalEntityReport.rdlc";
Any help would very greatly helpful, please need some help as it is urgent, thanks in advance.
|
|
|
|
|
Try:
reportViewer.LocalReport.ReportPath = Request.MapPath("~/Reports/LegalEntityReport.rdlc");
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
We have an IIS server that is hosting multiple web applications. Once in a blue moon the odd pool gets jammed up and needs to be manually recycled which means we currently have to RD into the server, open IIS - find the pool, right click etc.
We want to develop a web page that lists all the pools and allows us to click a recycle button.
Is that possible and if so does anyone know how to do it ?
Thanks
Mike
|
|
|
|
|
I just googled "programatically recycle iis app pool" and found the code in seconds. If you do the same you'll find lots of articles discussing this.
|
|
|
|
|
The following code will recycle the current site's app pool. You need to add a reference to Microsoft.Web.Administration
using (ServerManager iisManager = new ServerManager())
{
SiteCollection sites = iisManager.Sites;
foreach (Site site in sites)
{
if (site.Name == HostingEnvironment.ApplicationHost.GetSiteName())
{
iisManager.ApplicationPools[site.Applications["/"].ApplicationPoolName].Recycle();
break;
}
}
}
|
|
|
|
|
Thank you. We tried that and we have it working on a local PC server but when we move it to a regular Windows Server we get a permissions error. We have IIS_IUSRS full control and we still get the same error on the server. Are we missing some other sort of permission ?
We get this ................
Filename: redirection.config Error: Cannot read configuration file due to insufficient permissions
at Microsoft.Web.Administration.Interop.IAppHostAdminManager.GetAdminSection(String bstrSectionName, String bstrPath) at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath) at Microsoft.Web.Administration.ServerManager.SitesSectionCreator() at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory) at Microsoft.Web.Administration.ServerManager.get_SitesSection() at Microsoft.Web.Administration.ServerManager.SitesCollectionCreator() at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory) at Microsoft.Web.Administration.ServerManager.get_Sites() at RefreshAppPool.Controllers.HomeController.GetApplicationPool()
|
|
|
|
|
Hi All,
I am a new developer using Visual Studio 2017.
I wish to create a Asp.net web application that will control (Allow/Deny) access to certain pages based on which Group the User is a member of in a already existing Active Directory Setup on our network(e.g. if the user is Member of "Accounts" Group they will only see Accounting pages).
How will I be able to implement this after creating a new ASP.NET application(project)?
I only know that there is a "Change Authentication" option when creating the solution, but how would I proceed from there?
After that, how would I reference the user's Group value to control page access?
Any help is greatly appreciated.
Regards,
Patrick
|
|
|
|
|
Hi out there,
I am working on Ajax Tab and come across many CSS for Ajax tab.
One of the thing which I do not see people mention if how to CSS a tab panel when it is disabled.
I do see CSS for active, normal, hover but nothing for disabled.
When I what to disable the tab, I use server code: "tabID.Enabled = false"
Yes, the tab is disabled, but I like change the text color to something else, say grey. Currently, it always showed as if normal.
My custom CSS is called "ajax__tab_xp1"
Please help. Thank you in advance.
|
|
|
|
|
Hi I have a web API and it returns IEnumerable<classa>. ClassA is a wrapper collections of ClassB and ClassC (as child property). If ClassB and ClassC has count 0, I can able to get data in my client from Web API. When Class B has value (greater than count 0), I get error "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host". I am working in VS 2017 and .Net Core 2.0 Please advise
|
|
|
|
|
hi,
I want to create a report with Group, like for example, all students of a School, then every class becomes a group, it displays only once for every group then each student information will be displayed in one row. When Class 1 finishes Class 2 starts but only once in the group. But Group (Class name) will be first column and rest follows in the same order, it looks like nothing but a query result but only thing is in query result for every record Group repeats but here Group should come only in the beginning of the group.
I am using stored procedure and Dataset to load the report, any help would be greatly helpful, a suggestion, code snippet or even a link helps a lot thanks in advance.
|
|
|
|
|
Hi,
I created a report and getting it displayed using ReportViewerForMvc, but I want to set its height, I tried in the below way by trying to set in the code of the Controller Action method but still its height is not set to the limit I want to set it to. Any help would be greatly helpful, thanks in advance.
Controller:
public ActionResult ShowLegalEntityReport(string legalEntityNumber, string lENumOperator, string legalEntityName, string lENameOperator
, string taxId, string taxIdOperator, string submittingCounty, string submCountyOperator, string legalEntityCity, string lECityOperator)
{
ReportViewer reportViewer = new ReportViewer();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.SizeToReportContent = true;
reportViewer.Width = Unit.Percentage(900);
reportViewer.Height = Unit.Percentage(700);
DataRetrieveServiceClient drsc = new DataRetrieveServiceClient();
DataTable dt = CommonFunctions.ToDataTable(drsc.GetLegalEntityReport(legalEntityNumber, lENumOperator, legalEntityName, lENameOperator, taxId, taxIdOperator
, submittingCounty, submCountyOperator, legalEntityCity, lECityOperator));
reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"\Reports\LegalEntityReport.rdlc";
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("LegalEntityDataSet", dt));
ViewBag.ReportViewer = reportViewer;
return View();
}
The reportviewer cshtml has the following:
@using ReportViewerForMvc;
@{
ViewBag.Title = "Show Legal Entity Report";
Layout = "~/Views/Shared/_LayoutFinal.cshtml";
}
@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
modified 31-Oct-18 14:35pm.
|
|
|
|
|
At a guess, reportViewer.SizeToReportContent = true; tells the control to ignore the explicit width and height you've specified.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
If I don't set it the report may have gap after the content or it may exceed the width etc, is there any way just to set the width to the full content width but height has limit, I am not sure but if anybody can give me a better solution, it would a great help.
|
|
|
|
|
My table have 10 récords and when i use my method only have a "0" that means only read one record
using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
if (string.IsNullOrEmpty(sdr["Code"].ToString()))
{
C_E = "0";
this.Update(C_E);
}
else
{
C_E = sdr["Code"].ToString();
this.Update(C_E);
}
}
|
|
|
|
|
If your reader just getting 1 records back from your stored procedure, you need to check the query in your SP to check if it really returning the expected data rows...
modified 20-Sep-20 21:01pm.
|
|
|
|
|
I wish to create a database-driven website in ASP.NET for a non-profit project validating election results in South Africa. I have extensive SharePoint experience, but licensing makes that a non-starter.
I can work in C# and Visual Studio, but have little experience building websites from scratch. I need to build a site that can accept data entry from multiple users, and also carry out large numbers of SQL queries. The site must be responsive from the outset.
Is there a website template I can use for Visual Studio, or would an ASP.NET CMS like Umbraco be best for me? I have not used MVC, but am familiar with coding in forms.
I would appreciate any comments and suggestions. This is a private initiative, and is being done part-time, and I want to concentrate on the database design and querying more than creating a good website framework.
|
|
|
|
|
Please do not repost the questions, if you want to make changes you can always edit your original post and add more information in that one, that helps members in answering your queries better.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
You should create site from scratch and use a html template to design and use MVC as it is easy to develop it in MVC
|
|
|
|
|
I am comfortable creating SQL databases, and reasonably adept at C# coding and normal website design. I need to create a database-driven website, where a number of users will capture data, and where many users will be able to view the results of a large number of different database queries. CMS capability would be a plus. I want a responsive interface from the word go, and I want to focus on my database development and querying, rather than building a website and basic CRUD operations from scratch.
Is there a website template available, with user management, and with the basic site infrastructure available, or should I use one of the ASP.NET CMSs, like Umbraco? I have extensive SharePoint experience, but the licensing prohibits SharePoint online. This is for a non-profit project aimed at election result validation in South Africa. I have not used MVC before.
Any thoughts, suggestions?
|
|
|
|
|
That is like a huge project, sadly, discussions are not that much broad to cover every aspect of this project. I will like to talk about a few key areas here,
Quote: I need to create a database-driven website Your best bet would be on an ORM, consider using something like Entity Framework and develop your website on top of that. It can help you with most of the SQL stuff that you will have to do yourself.
Entity Framework | Microsoft Docs
Quote: where a number of users will capture data, and where many users will be able to view the results of a large number of different database queries Please also study the publisher-consumer pattern, this seems to be moving toward that—something like a blog website where a few users are publishing content, and almost every user is reading it.
Producer–consumer problem - Wikipedia
Quote: CMS capability would be a plus. CMS or page builder? Both these have their own libraries and tools that you can use in ASP.NET.
Quote: I want a responsive interface from the word go That is what Bootstrap is there for.
Bootstrap · The most popular HTML, CSS, and JS library in the world.
Quote: Is there a website template available, with user management, and with the basic site infrastructure available, or should I use one of the ASP.NET CMSs, like Umbraco?
Yes, Umbraco is your only bet for the time being. And lastly, do not just depend on your extensive SQL knowledge and try to jump in the wild west of the Internet. There are several things that you need to know before you can publish the website, especially a website that is going to have a huge amount of user base and queries to database.
There are several concepts like, scaling, caching, security, responsiveness (as you have mentioned), and much more. Best bet is to consider an open source solution and leave everything to it. If you cannot then please study these concepts before moving forward.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I'm reading a book and the author is discussing DI using Ninject. Now time/work constraint aren't allowing me to keep reading yet. Here is my question. I read that, for using 'deleting' user accounts in an individual login method.
Can I use DI to start the context object and pass it when need.
|
|
|
|
|
Yes.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
I have a radgrid hierarchy structure. When the user navigates to the third level and clicks on the parent tickmark on the grid, the RadGrid1_ItemCommand is fired and I can retrieve the parent "ProgramID".
But I need to pickup the parentID when the user clicks on the command-template button located just on top of the detail rows. I would like to get the value within a client-side function or server-side if that is easier??? (but cannot get that to work well).
Thank you for you help with this request!
Client-Side code:
function openWindowNEW(sender, args) {
var programID= parentItem.OwnerTableView.Items[sender.Item.ItemIndex].GetDataKeyValue("ProgramID"); //...not working
radopen("Storyboard.aspx?carID=programID, "RadWindow2");
}
Server-Side Code:
console.write((string) sender.Item.OwnerTableView.Items[e.Item.ItemIndex].GetDataKeyValue("ProgramID").ToString());
The code works below but it needs it to work from within a client-side function....
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
{
if (e.Item.OwnerTableView.DataSourceID == "SqlDataSource3")
{
GridDataItem parentItem = (GridDataItem)(e.Item.OwnerTableView.ParentItem);
if (parentItem != null)
{
//..tier 2 parent
Console.Write(parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["StrategicInitID"]);
//..tier 3 parent
HiddenProgramIDSelected.Value = (string)e.Item.OwnerTableView.Items[e.Item.ItemIndex].GetDataKeyValue("ProgramID").ToString();
}
}
}
|
|
|
|
|
|
I am trying to create to create two dynamic TextBoxes on Button click1. The first time i click i get 2.
The second time 4 ans so on when I only want two (2)
protected void Page_PreInit(object sender, EventArgs e)
{
List<string> keys = Request.Form.AllKeys.Where(key => key.Contains("txtDynamic")).ToList();
int i = 1;
foreach (string key in keys)
{
this.CreateTextBox("txtDynamic" + i);
i++;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
int index = pn1TextBoxes.Controls.OfType<TextBox>().ToList().Count + 1;
this.CreateTextBox("txtDynamic" + index);
}
private void CreateTextBox(string id)
{
for (int i = 1; i <= 2; i++)
{
TextBox txt = new TextBox();
txt.ID = id + i.ToString();
txt.TextMode = TextBoxMode.MultiLine;
txt.Height = 60;
txt.Width = 300;
pn1TextBoxes.Controls.Add(txt);
}
Literal lt = new Literal();
lt.Text = "<br/>";
pn1TextBoxes.Controls.Add(lt);
}
|
|
|
|
|