Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

JimFeng

@JimFeng
About
Posts
63
Topics
27
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    Thank you Rick, after I changed the parm type, and the helper works in my ASP.NET Core 2.1 MVC app.

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    @using HtmlHelperExt is already in the _ViewImports.cshml, but got the same error.

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    My assembly is a custom HtmlHelper NOT TagHelper.

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    I added @addTagHelper *, HtmlHelperExt in _ViewImports.cshtml file but still got error: Error: CS1061 'IHtmlHelper' does not contain a definition for 'CHDropdownMenu' and no accessible extension method 'CHDropdownMenu' accepting a first argument of type 'IHtmlHelper' could be found (are you missing a using directive or an assembly reference?) on the View page like this (the same as on MVC 5): @model System.Data.DataSet @using HtmlHelperExt; ...... @Html.CHDropdownMenu(Model, "mnuSample1", new { MenuOpenType = "Hover" }) ...... My Custom helper like this: namespace HtmlHelperExt { public static class HtmlHelperExt { public static IHtmlContent CHDropdownMenu(this HtmlHelper htmlHelper, DataSet ds, string divID, object htmlAttributes = null) { ...... return new HtmlString(tbDiv_Menu.ToString()); } } }

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    @Html.CHGridTable(......) works on MVC5 but not ASP.NET Core MVC.

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    Thanks, I corrected error in my custom helper, but when I call the helper from views as following: @HtmlHelperExt.CHGridTable(Model, new { tablename = "tblTest", defaultcolsort = "3" }) and got following error: Error CS0411 The type arguments for method 'HtmlHelperExt.CHGridTable(HtmlHelper, DataTable, object)' cannot be inferred from the usage. Try specifying the type arguments explicitly. The call on MVC5 works file, How can I use the custom helper on view of Core Web Application (MVC6): The custom helper code as following: public static IHtmlContent CHGridTable(this HtmlHelper htmlHelper, DataTable dt, object htmlAttributes = null) { var urlHelperFactory = (IUrlHelperFactory)htmlHelper.ViewContext.HttpContext.RequestServices.GetService(typeof(IUrlHelperFactory)); var url = urlHelperFactory.GetUrlHelper(htmlHelper.ViewContext); ...... return new HtmlString(tbBtnAdd.ToString() + tbGridTable.ToString() + script.ToString()); }

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    Thanks again for your patient. when I code following: var urlHelper = _urlHelperFactory.GetUrlHelper(_httpContextAccessor.HttpContext); and got the following error: Argument 1: cannot convert from 'Microsoft.AspNetCore.Http.HttpContext' to 'Microsoft.AspNetCore.Mvc.ActionContext' the error was caused by argument: _httpContextAccessor.HttpContext

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    Thanks for your response. I'm new to ASP.NET Core and still have following questions: 1. Where should I put ConfigureServices method? 2. My current MVC5 custom helper like following: public static class HtmlHelperExt { public static IHtmlString CHGridTable(this HtmlHelper htmlHelper, DataTable dt, object htmlAttributes = null) { UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext); string urlEdit = url.RouteUrl("Default"); ...... } ......//many other custom helpers } How can I inject the IActionContextAccessor and use it in my custom helper CHGridTable and other helpers? 3. How can I use the ContextAccessor to get info for the code lines below: UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext); string urlEdit = url.RouteUrl("Default");

    ASP.NET asp-net csharp dotnet architecture tutorial

  • Access HttpContext in ASP.NET Core
    J JimFeng

    I have following code in ASP.NET MVC5 custom helper need to be converted in ASP.NET Core MVC custom helper: UrlHelper url = new UrlHelper(HttpContext.Current.Request.RequestContext); string urlEdit = url.RouteUrl("Default"); I have read Microsoft doc about how to access HttpContext in ASP.NET Core but still cannot figure it out how to convert the above code.

    ASP.NET asp-net csharp dotnet architecture tutorial

  • How to access RDLC matrix subtotal value?
    J JimFeng

    Thank you. I get idea.

    ASP.NET question tutorial

  • How to access RDLC matrix subtotal value?
    J JimFeng

    Hi, I have a matrix on RDLC report viewer as following: C1 C2 Total Cnt % Cnt % Cnt % R1 20 30 50 R2 50 50 100 Total 70 80 150 The Subtotal values in column and row are auto-calculated by the matrix object. How can I access the subtotal value 70, 80, 150 to calculate the % values?

    ASP.NET question tutorial

  • OdbcCommandBuilder DeriveParameters Problem
    J JimFeng

    Hi, I use OdbcCommandBuilder.DeriveParameters to get a stored procedure parameters and fill them in with values. After that, I can access the command object to see all parameter's name and values. But when I fill the command with the data adapter I got the following error: ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure 'sSPName' expects parameter '@dteBeg', which was not supplied. Code: ...... Dim cmdODBC As OdbcCommand = cnnODBC.CreateCommand() cmdODBC.CommandTimeout = 300 cmdODBC.CommandType = CommandType.StoredProcedure cmdODBC.CommandText = sSPName cnnODBC.Open() OdbcCommandBuilder.DeriveParameters(cmdODBC) 'Add values to parameters: For i As Integer = 0 To cmdODBC.Parameters.Count - 1 ...... Next 'Write out the parameter's name and value: For Each parameter As OdbcParameter In cmdODBC.Parameters response.write(parameter.ParameterName & "=" & parameter.Value) Next Dim adpODBC As New OdbcDataAdapter(cmdODBC) adpODBC.Fill(ds, "Results") 'error appeal here. ...... Any helps are appreciated.

    .NET (Core and Framework) database help sql-server sysadmin

  • How to set up TypeName for objectDataSource in single-file model?
    J JimFeng

    What is what? Do you mean single-file model? Do you know there are two models (code-behind and sigle-file or inline) that you can use to develope asp.net application?

    ASP.NET question tutorial

  • How to set up TypeName for objectDataSource in single-file model?
    J JimFeng

    Anyone can tell me how to set up TypeName of objectDataSource in a single-file model ASPX page? Since there is no class file in single-file model, how can I set up the TypeName???

    ASP.NET question tutorial

  • Process.Start fails on clustered servers???
    J JimFeng

    I start a process pdftk.exe to merger PDF files in ASP.NET web application. It woks fine in a single web server environment but doesn’t work in a web farm (2 clustered web servers) environment (got ExitCode = 1). Anyone have any ideas?

    ASP.NET csharp asp-net sysadmin question workspace

  • Lost selection from dropdownlist after postback???
    J JimFeng

    Thanks for your response. I use two-way databinding and I can not stop the databind.

    ASP.NET sysadmin question

  • Lost selection from dropdownlist after postback???
    J JimFeng

    I have 2 dropdownlists on a formview. The list of the second one (ddl_2) is depend on the selected value of the first one (ddl_1). I use a client callback function (GetDDL2List) on event OnChange to retrieve the list for the second one. After I selected for a value from the first one list of the second come out correctly. After I make a selection from the second one and submit (post back) the form, however, the selection of the second one is lost. <asp:DropDownList ID="ddl_1" Runat="server" DataSourceID="ods_1" DataValueField="cde_item" DataTextField="txt_item" OnDataBound="ddl_1_DataBound" onchange="GetDDL2List(this.value, 'ddl'); " /> <asp:ObjectDataSource ID="ods_1" Runat="server" TypeName="Proj1.Test" SelectMethod="GetList1" </asp:ObjectDataSource> <asp:DropDownList ID="ddl_2" Runat="server" DataSourceID="ods_2" DataValueField="cde_tem" DataTextField="txt_item" OnDataBound="ddl_2_DataBound" /> <asp:ObjectDataSource ID="ods_2" Runat="server" TypeName="Proj1.Test" SelectMethod="GetList2" <SelectParameters> <asp:ControlParameter Name="sGroup" ControlID="ddl_1" DefaultValue="-1" Type="string" /> </SelectParameters> </asp:ObjectDataSource>

    ASP.NET sysadmin question

  • How to access a cached objectdatasource data of a formview?
    J JimFeng

    I have a form view that use objectDataSource with cache enable as following: <asp:ObjectDataSource ID="odsTest" Runat="server" EnableCaching="true" CacheDuration="300" CacheExpirationPolicy="Sliding" CacheKeyDependency="ckdCaseExam" TypeName="App.Test" SelectMethod="GetTestList" UpdateMethod="fvwTest"> *Assuming the SELECT item1, item2, item3 from tblTest WHERE item4 =’Y’ I need to access the cached data to check something in code behind without refresh the data. How can I do it?

    ASP.NET question sysadmin tutorial

  • Trigger validationsummary message box
    J JimFeng

    When I set a onClientClick=”jsfunction()” on a submit button the validationsummary message box would not show up; How can I trigger validationsummary message box in the function jsfunction() if it is invalidate page?

    ASP.NET question database

  • How to delete a file after it's opened in a browser?
    J JimFeng

    What I'm trying to do is to create a PDF file from a local report viewer and open the file from IE browser. In this way, client have full control on the report, like to print selected page. (I know that the server side report viewer can do the same but we're not ready to use it yet.) I use session ID as file name so it should no problem for other session user. Can you show me some examples on popup and mime type? Thanks in advance.

    ASP.NET question help tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups