I am using HtmlAgilityPack to perform Scraping in C #, so far I have not had problems when doing Scratch from several web, however, trying to eject the following code I get an error

Var getHtmlWeb = new HtmlWeb ();
Var home page = getHtmlWeb.Load ("https://www.corfo.cl/");

The error that appears is:

"Connection terminated: Unexpected sending error."

The only web that is giving me problems is Corfo and not how to solve this. I appreciate your help

I have a website solution created in VS 2015 and have added a project to manage the Data Access C# functions. The data access project is defined to the namespace "MyCo.DataAccess" and generates a DLL file (coDataAccess.dll) which is then referenced in the website project. The C# code behind the asp page contains a reference to the namespace.

using MyCo.DataAccess;

In development, builds are good & everything works as expected with references to the dependent functions. When testing the website, however, an error occurs:

Compiler Error Message: CS0234: The type or namespace name 'DataAccess' does not exist in the namespace 'MyCo' (are you missing an assembly reference?)

Source Error:        
Line 6:  using System.Web.UI;
Line 7:  using System.Web.UI.WebControls;
Line 8:  using MyCo.DataAccess;

There has been multiple possible solutions, but none have worked yet:

  • Signing the DLL and adding it as an assembly reference in the web.config
  • Clearing out the obj folder and rebuilding

Thanks in advance.

@Html.DropDownListFor(m => m.CategoryId, new SelectList(Model.CategoryLookUp, "Value", "Text"), new { @class = "form-control" })

==> Here I can Select element by Id, $("#CategoryId").val() //etc. but I want to select All "Html.DropDownListFor" or any kind of helper to add a css class.

I just simply add new " { @class = "form-control myClass" }) ", and it works fine, but over 1000+ dropdownList have in my project, for that I wrote a class, and now i want to add this class to all dropdownList.

I have a .NET Core web app which has an API. I've defined an Middleware class based on this answer like so:

public class ErrorHandlingMiddleware
{
    private readonly RequestDelegate next;
    private readonly ILogger logger;

    public ErrorHandlingMiddleware(RequestDelegate next,
        ILoggerFactory loggerFactory)
    {
        this.next = next;
        logger = loggerFactory.CreateLogger<ErrorHandlingMiddleware>();
    }

    public async Task Invoke(HttpContext context)
    {
        try
        {
            await next(context);
        }
        catch (Exception ex)
        {
            logger.LogError(0, ex, "An unhandled exception has occurred: " + ex.StackTrace);
            await HandleExceptionAsync(context, ex);
        }
    }

    private static Task HandleExceptionAsync(HttpContext context, Exception exception)
    {
        var code = HttpStatusCode.InternalServerError;
        var message = exception.Message;
        if (exception is BadRequestException)
        {
            code = HttpStatusCode.BadRequest;
        }
        else if (exception is NotFoundException)
        {
            code = HttpStatusCode.NotFound;
        }
        else if (exception is NotAuthorizedException)
        {
            code = HttpStatusCode.Forbidden;
        }
        else if (exception is NotAuthenticatedException)
        {
            code = HttpStatusCode.Unauthorized;
        }
        else
        {
            message = "An unexpected error occurred.";
        }

        var result = JsonConvert.SerializeObject(new { error = message });
        context.Response.ContentType = "application/json";
        context.Response.StatusCode = (int)code;
        return context.Response.WriteAsync(result);
    }
}

The error handling only handles when an exception is thrown in code. A bad route does not throw an exception. The problem is that if I try to access a non-existent API route - that is, one that follows the API route convention and starts with "/api/adfasdf" - the API returns HTML (or the error page or the home page, I forget).

I've received some suggestions to check the context.Response.StatusCode after await next(context); executes, but it's 200.

How can I configure my web app such that it recognizes a bad API route and returns a 404?

UPDATE Here is where/when I load the middleware in my Startup class:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime, IOptions<OidcConfig> oidcConfigOptions)
{
    loggerFactory.AddConsole(Configuration.GetSection("Logging"));
    loggerFactory.AddDebug();

    // Add Serilog to the logging pipeline
    loggerFactory.AddSerilog();

    app.UseMiddleware<ErrorHandlingMiddleware>();

    if (env.IsLocal())
    {
        app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
        {
            HotModuleReplacement = true
        });
    }

    var oidcConfig = oidcConfigOptions.Value;

    // Configure the app to use Jwt Bearer Authentication
    app.UseJwtBearerAuthentication(new JwtBearerOptions
    {
        AutomaticAuthenticate = true,
        AutomaticChallenge = true,
        Authority = oidcConfig.GetAuthority(),
        Audience = oidcConfig.ResourceAppId,
        TokenValidationParameters = new TokenValidationParameters
        {
            RequireExpirationTime = true,
            RequireSignedTokens = true,
            ValidateAudience = true,
            ValidIssuer = oidcConfig.GetIssuer(),
            ValidateIssuer = true,
            ValidateActor = false,
            ValidateLifetime = true,
            ValidateIssuerSigningKey = true
        },
    });

    app.UseSiteIdClaimInjection();

    app.UseStaticFiles();

    app.UseMvc(routes =>
    {
        routes.MapRoute(
            name: "default",
            template: "{controller=Home}/{action=Index}/{id?}");

        routes.MapSpaFallbackRoute(
            name: "spa-fallback",
            defaults: new { controller = "Home", action = "Index" });
    });

    appLifetime.ApplicationStopped.Register(() => this.ApplicationContainer.Dispose());
}

Here's the situation.

I have a save, and a print button :

<input name="btnSubmit" type="submit" value="Save" /> 
<input name="btnSubmit" type="submit" value="Print"/> @*Redirect to Action("Print", "controler")*@

But the print button has to open a new tab. If it was just me, I obviously know I have to save before printing... it would not be an issue. I could use this link with target blank instead :

<a target="_blank" href="@Url.Action("Print", "controler", new { id = Model.id })" type="submit" value="Print" > Print</a>

Easy, but now some users think that the print button should ALSO save the page. Because they don't push save... they just print and the model changes are lost because I can't call the post action in my print link... it's a link.

I thought, at first, that I could make an asynchronous call to a save fonction, but my model is way too big, it requires the post back of it's own action (right ?)

Went through this :

How do I use Target=_blank on a response.redirect?

And i'm not sure if it really help in MVC... right now i'm stuck here :

[HttpPost]
public ActionResult MyForm(string btnSubmit, formModel model)
{
    if (btnSubmit == "Print")
    {
        dbSave(model);
        return RedirectToAction("Print", "controler"); // Won't open new tab... 
    }
}

I have a mediocre skill level with VS and C#. I'm attempting to add a .ascx file with codebehind to an existing project in its user controls.

Right-clicking UserControls -> Add -> New Item and searching "web user control" returns "No items found."

Copy-pasting an existing .ascx file (there are more than a dozen) successfully creates the new .ascx file, but there's no .ascx.cs or .ascx.designer.cs files attached and no apparent way to add them.

More information

Copying "MyUserControl.ascx" was indeed copying the codebehind files, but they were copied under the original "MyUserControl.ascx" file as "MyUserControl - Copy.ascx.cs" and ""MyUserControl - Copy.ascx.designer.cs". VS does not allow these files to be renamed or moved.

So, I removed these files from the project, changed their names in file explorer, added them back to the project and updated the code as I needed.

However, they don't appear nested, but on the same level as the .ascx files.

Also tried

Created a blank web app and could add it there, so it's something project-specific.

Tried adding the file as existing after copying in file explorer, with the intent to generate the code behind files - there's no Convert to Web Application option, even when selecting the solution directly and even under the project menu in VS2015 for my project, as suggested by How do you force Visual Studio to regenerate the .designer files for aspx/ascx files?

I'm running Visual Studio 2015 Enterprise Update 1.

I created an empty Visual Basic ASP.NET Website targeting the .NET Framework 4.5.2. And I want to convert it to an ASP.NET Web Application.

Under the Website's context menu in Solution Explorer there is no "Convert to Web Application" menu-item, nor is there anything under the Website menu in the main-menu bar:

enter image description here

enter image description here

Where has the feature gone? Has it been removed completely in Update 1?

I am developing a little project for a local school and I am pretty much what you can call a newbie in programming. I am trying to retrieve a selected date by the user in the calendar to save to a separate database. I have an Entity Framework model (.edmx) to link the table in Visual Studio that I need. This is what I got so far:

ASP.net:

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="main_banner">
    </div>
    <div class="main_container">
        <div class="main_heading">
            <h1 class="main_title">Projector Inspection</h1>
            <p><a href="AddProjector.aspx">Add</a> new Projector</p>
        </div>
        <div class="info_container">
            <div>
                <asp:Label ID="RoomNolbl" runat="server" Text="Room No:"></asp:Label>
             </div>
            <div>
                <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="Roomsdbo" DataTextField="Room_No" DataValueField="Room_No" AutoPostBack="True">
                    <asp:ListItem>---Select Room---</asp:ListItem>
                </asp:DropDownList> 
                <asp:SqlDataSource ID="Roomsdbo" runat="server" ConnectionString="<%$ ConnectionStrings:iPadLoanConnectionString2 %>" SelectCommand="SELECT [Room_No] FROM [tblRooms]"></asp:SqlDataSource>
             </div>

             <div>
                <asp:Label ID="Datelbl" runat="server" Text="Date Checked:"></asp:Label>
             </div>
            <div>
                <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="White" BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px" NextPrevFormat="FullMonth" Width="350px" OnSelectionChanged="Calendar1_SelectionChanged1" DayNameFormat="Shortest">
                    <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
                    <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
                    <OtherMonthDayStyle ForeColor="#999999" />
                    <SelectedDayStyle BackColor="#333399" ForeColor="White" />
                    <TitleStyle BackColor="White" BorderColor="#ae1022" BorderWidth="4px" Font-Bold="True" Font-Size="12pt" ForeColor="#ae1022" />
                    <TodayDayStyle BackColor="#CCCCCC" />
                </asp:Calendar>
                <asp:TextBox ID="Calendartxt" runat="server" ReadOnly="True"></asp:TextBox>
             </div>

            <div class ="info_container_task">
                <h3>Task carried</h3>
            <div>
                <asp:Label ID="CheckBoxFilterlbl" runat="server" Text="Filter Cleaning:"></asp:Label>
                <asp:CheckBox ID="CheckBoxFilter" runat="server" OnCheckedChanged="CheckBoxFilter_CheckedChanged" AutoPostBack="true" />
            </div>
            <div>
                <asp:Label ID="CheckBoxBulblbl" runat="server" Text="Bulb Replacement:"></asp:Label>
                <asp:CheckBox ID="CheckBoxBulb" runat="server"  OnCheckedChanged="CheckBoxBulb_CheckedChanged" AutoPostBack="true"/>
            </div>
            <div>
                <asp:Button ID="ButtonSubmit" runat="server" Text="Submit" OnClick="ButtonSubmit_Click" />
            </div>
          </div>
             <div>
                <asp:Label ID="HourCountBulblbl" runat="server" Text="Bulb Hours:"></asp:Label>
             </div>
            <div>
                <asp:TextBox ID="HourBulbtxt" runat="server" ></asp:TextBox>
             </div>
            <div>
                <asp:Label ID="FilterHourlbl" runat="server" Text="Filter Hours:"></asp:Label>
            </div>
            <div>
                <asp:TextBox ID="FilterHourtxt" runat="server" ></asp:TextBox>
            </div>
             <div>
                <asp:Label ID="Commentslbl" runat="server" Text="Additional Comments:" ></asp:Label>
             </div>
            <div>
                <textarea id="Commentstxt" cols="20" rows="2" ></textarea>&nbsp;</div>
        </div>

    </div>
<div class="sub_container">
    <h2>Additional Information</h2>
<div class="Tbl_Projectorinfo">
    <div class="projectorGrid">
            <asp:GridView ID="projectorinfo" runat="server" AutoGenerateColumns="False" CellPadding="4" DataSourceID="linkprojectorsdbo" ForeColor="#333333" GridLines="None" DataKeyNames="Model_No">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="Current_Hours" HeaderText="Current_Hours" SortExpression="Current_Hours" />
                    <asp:BoundField DataField="Last_Replacement_Date" HeaderText="Last_Replacement_Date" SortExpression="Last_Replacement_Date" />
                    <asp:BoundField DataField="Last_Cleaned" HeaderText="Last_Cleaned" SortExpression="Last_Cleaned" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#ae1022" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#ae1022" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            </asp:GridView>
        </div>
            <asp:SqlDataSource ID="linkprojectorsdbo" runat="server" ConnectionString="<%$ ConnectionStrings:iPadLoanConnectionString %>" SelectCommand="SELECT [Model_No], [Current_Hours], [Last_Replacement_Date], [Last_Cleaned] FROM [tblProjectors] WHERE ([Room_No] = @Room_No)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="Room_No" PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="tblModels" CellPadding="4" ForeColor="#333333" GridLines="None">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:BoundField DataField="Manufacturer" HeaderText="Manufacturer" SortExpression="Manufacturer" />
                    <asp:BoundField DataField="Model_Name" HeaderText="Model" SortExpression="Model_Name" />
                    <asp:BoundField DataField="Min_Hours" HeaderText="MinHours" SortExpression="Min_Hours" />
                    <asp:BoundField DataField="Max_Hours" HeaderText="MaxHours" SortExpression="Max_Hours" />
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#ae1022" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#ae1022" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#E9E7E2" />
                <SortedAscendingHeaderStyle BackColor="#506C8C" />
                <SortedDescendingCellStyle BackColor="#FFFDF8" />
                <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
            </asp:GridView>
            <asp:SqlDataSource ID="tblModels" runat="server" ConnectionString="<%$ ConnectionStrings:iPadLoanConnectionString %>" SelectCommand="SELECT [Manufacturer], [Model_Name], [Min_Hours], [Max_Hours] FROM [ProjectorsRoom2017] WHERE ([Room_No] = @Room_No)">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList1" Name="Room_No" PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
            </asp:SqlDataSource>
        </div>
    </div>

.cs File:

 protected void ButtonSubmit_Click(object sender, EventArgs e)
    {
        tblProjector entry = new tblProjector();
        entry.Last_Cleaned = Convert.ToDateTime(Calendartxt.Text);
        iPadLoanEntities db = new iPadLoanEntities();
        db.tblProjectors.Add(entry);
        db.SaveChanges();
    }




    protected void Calendar1_SelectionChanged1(object sender, EventArgs e)
    {
        Calendartxt.Text = Calendar1.SelectedDate.ToShortDateString();
    }
}

I am constantly getting an error saying validation for one or more than one entities failed. Also the error points to the line of code:

db.SaveChanges();

I know that with that code I am trying to get the information of the TextBox that is linked to the calendar to be saved to the database but to be honest saving it directly from the calendar would be great if it is possible.

If anyone could give me a hand on how to be able to achieve this I would be grateful. Thanks

This question already has an answer here:

With .NET-Core apps the configuration data read from some file/environment is loaded into an IConfigurationRoot instance. But I keep seeing examples that show that the injected instance is an IOptions<T> .. not an IConfigurationRoot.

  • Why IOptions?
  • What is the advantage of this class instead of just having my own AppSettings POCO?
  • Do I need to do it this way? Is there another way?

For example..

public static IConfigurationRoot Configuration { get; set; }

public Startup(IHostingEnvironment env)
{
    var builder = new ConfigurationBuilder().SetBasePath(env.ContentRootPath)
                                            .AddJsonFile("appSettings.json", true, true)
                                            .AddJsonFile($"appSettings.{env.EnvironmentName}.json", true)
                                            .AddEnvironmentVariables();
    Configuration = builder.Build();
}

public void ConfigureServices(IServiceCollection services)
{
    // Register the IConfiguration instance which MyOptions binds against.
    services.Configure<AppConfiguration>(Configuration);

    // <snip other stuff>
}

public AccountController(IOptions<AppConfiguration> appConfiguration)
{
    // do stuff with appConfiguration here.
}

I'm trying to implement a nested gridview with expand/collapse functionality. My problem is that the jquery click function is not working. The scenario is as follows:

JQUERY:

$("[src*=plus]").on("click", "img", function () {
            alert('hi');
            $(this).closest("tr").after("<tr><td></td><td colspan = '999'>" + $(this).next().html() + "</td></tr>")
            $(this).attr("src", "images/minus.png");
        });
        $("[src*=minus]").on("click", "img", function () {
            $(this).attr("src", "images/plus.png");
            $(this).closest("tr").next().remove();
        });

GRIDVIEW:

<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false"
        DataKeyNames="Id" OnRowDataBound="OnRowDataBound">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <img alt = "" style="cursor: pointer" src="images/plus.png" />
                    <asp:Panel ID="pnlOrders" runat="server" Style="display: none">
                        <asp:GridView ID="gvOrders" runat="server" AutoGenerateColumns="false">
                            <Columns>
                                <asp:BoundField ItemStyle-Width="150px" DataField="Id" HeaderText="Order Id" />
                                <asp:BoundField ItemStyle-Width="150px" DataField="Policy" HeaderText="Date" />
                            </Columns>
                        </asp:GridView>
                    </asp:Panel>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField ItemStyle-Width="150px" DataField="Id" HeaderText="Contact Name" />
            <asp:BoundField ItemStyle-Width="150px" DataField="Name" HeaderText="City" />
        </Columns>
    </asp:GridView>

Now, if I change the .on() method with the .live() method, then it works just fine. Any of you jQuey savvy people know what I'm doing wrong. Thanks!

I try to make https on my asp.net mvc website like this in web config

<rewrite>
  <rules>
    <rule name="Redirect to https">
      <match url="(.*)"/>
      <conditions>
        <add input="{HTTPS}" pattern="Off"/>
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"/>
    </rule>
  </rules>
</rewrite>

But when I compile project on localhost I have this error

Error

On staging all okay.

Where is my problem?

According to MSDN

Both the local log in and social log in check to see if 2FA is enabled. If 2FA is enabled, the SignInManager logon method returns SignInStatus.RequiresVerification, and the user will be redirected to the SendCode action method, where they will have to enter the code to complete the log in sequence. If the user has RememberMe is set on the users local cookie, the SignInManager will return SignInStatus.Success and they will not have to go through 2FA.

I do want the user to be able to use the remember me feature of the application but I can not figure out how to get the cookie to ditch this setting so that the SignInStatus returns RequiresVerifacation. I'm actually not even 100% sure that the cookie is causing it. All I know is that I have enabled TFA and in AspUsers table I can see that TwoFactorEnabled is set to true but the status is always returning as Success.

I 'm trying to connect postgresql database remotely ( Heroku ). I use ASP Web api but always i have the same exception :Message "28000: no pg_hba.conf entry for host \"xx.xxx.xxx.xxxx\", user \"User", database \"databasename\", SSL off" I search some solution by editing the pg_hba.conf file and i add : host databasename username xx.xxx.xxx.xxxx md5 and no change .

My controller's Create method binds to a TestCase object:

public async Task<IActionResult> Create([Bind("Name, Description")] TestCase testCase)

and the View that does the model bind takes a ViewModel in, which is specified like so:

 public class CreateTestCaseViewModel
    {
        public string ProjectName { get; set; }

        public TestCase TestCase { get; set; }
    }

My view's code (which is just a form where you input Name and Description, and submit) is:

@model CreateTestCaseViewModel

@{
    ViewData["Title"] = "Create";
}

<h2>Create Test Case</h2>

<form asp-action="Create">
    <div class="form-horizontal">
        <hr />
        <div asp-validation-summary="ModelOnly" class="text-danger"></div>
        <div class="form-group">
            <label asp-for="TestCase.Name" class="col-md-2 control-label">
</label>
            <div class="col-md-10">
                <input asp-for="TestCase.Name" class="form-control" />
                <span asp-validation-for="TestCase.Name" class="text-danger"></span>
        </div>
    </div>

    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <div class="form-group">
        <label asp-for="TestCase.Description" class="col-md-2 control-label"></label>
        <div class="col-md-8">
            @*<input asp-for="Description" class="form-control" />*@
            <input asp-for="TestCase.Description" textarea class="form-control" id="Description" rows="5"/>

            <span asp-validation-for="TestCase.Description" class="text-danger"></span>
        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Create" class="btn btn-default"/>
        </div>
    </div>
</div>

<div>
        <a asp-action="Details">Back to List</a>
    </div>

    @section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

My goal is for my method to be able to take the ProjectName as an argument as well:

public async Task<IActionResult> Create([Bind("Name, Description")] TestCase testCase, string projectName)

How can I add it from the View?

I have a DropDownList in a GridView where the items for the DropDownList are retrieved with a database query. The following works:

<asp:TemplateField HeaderText="REWORK CATEGORIE">
    <ItemTemplate>
        <asp:SqlDataSource ID="REWORKCATEGORIE" runat="server" ConnectionString="<%$ ConnectionStrings:SQL_IP21 %>"
            SelectCommand="SELECT ID, CATEGORIE AS RWCAT FROM [LAB].[dbo].[IEP_CONFIG_CATREWORK]"></asp:SqlDataSource>
        <asp:DropDownList ID="ddlCategorie" AutoPostBack="true" DataTextField="RWCAT" DataValueField="RWCAT" DataSourceID="REWORKCATEGORIE" runat="server"  Width="120" SelectedValue='<%# Bind("RWCAT") %>'>
        </asp:DropDownList>
  </ItemTemplate>
</asp:TemplateField>

where I am binding the value in the DropDownList with the RWCAT field in the GridView DataSource.

However, what I need to do is bind the DropDownList with the CATID field in the GridView DataSource:

<asp:TemplateField HeaderText="REWORK CATEGORIE">
    <ItemTemplate>
        <asp:SqlDataSource ID="REWORKCATEGORIE" runat="server" ConnectionString="<%$ ConnectionStrings:SQL_IP21 %>"
            SelectCommand="SELECT ID AS CATID, CATEGORIE AS RWCAT FROM [LAB].[dbo].[IEP_CONFIG_CATREWORK]"></asp:SqlDataSource>
        <asp:DropDownList ID="ddlCategorie" AutoPostBack="true" DataTextField="RWCAT" DataValueField="CATID" DataSourceID="REWORKCATEGORIE" runat="server"  Width="120" SelectedValue='<%# Bind("CATID") %>'>
        </asp:DropDownList>
  </ItemTemplate>
</asp:TemplateField>

but when I try this I get the following error:

'ddlCategorie' has a SelectedValue which is invalid because it does not exist in the list of items.

The DataSource for the GridView is (stipped down a bit for brevity):

<asp:SqlDataSource ID="IEPBATCH" runat="server"
    ConnectionString="<%$ ConnectionStrings:SQL_IP21 %>"
    ProviderName="<%$ ConnectionStrings:SQL_IP21.ProviderName %>"
    SelectCommand="select 
                        [B].[BATCH_NR] as [BATCH_NR]
                        ,[C].[CATEGORIE] as [RWCAT]
						,[C].[ID] as [CATID]
                        from LAB.dbo.IEP_BATCH B
                        LEFT OUTER JOIN LAB.dbo.IEP_REWORK_LABO L  ON B.BATCH_NR = L.BATCH_NR
                        LEFT OUTER JOIN LAB.dbo.IEP_CONFIG_CATREWORK C ON L.REWORKCAT=C.ID  
                        order by B.BATCH_NR desc">
</asp:SqlDataSource>

I've been looking this over for hours now and for the life of me cannot figure out why the first one works, but not the second.

Any help would be greatly appreciated.

I wanna update just one parameter of record in my BD... not whole record, but just one parameter (Stav). I am using NHibernate and I access trought DAO.

            Rezervace_dao rezervaceDao = new Rezervace_dao();
            r.Stav = 1;
            rezervaceDao.Update(r);

code above update whole record, but that's not what I want.

Thank you a lot.

Style of dropdown in css changes when the page loads. i have tried a number of ways to solve the problem. also i am not able to find dropdownlist id in Update Trigger... any suggestions to help me out...i am stuck at this..thank you in advance...

        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:GridView runat="server" ID="gvDetails" AutoGenerateColumns="False" ShowHeaderWhenEmpty="True"
                    ForeColor="#333333" GridLines="None" ShowFooter="True" Width="855px">

                    <Columns>
                        <asp:BoundField DataField="SNo" HeaderText="S.N." ReadOnly="true" />
                        <asp:TemplateField Items Detail"
                            ControlStyle-Width="150px" ItemStyle-HorizontalAlign="center">
                            <ItemTemplate>
                                <asp:DropDownList ID="ddlItem" runat="server" ForeColor="Black" Height="35px" CssClass="chzn-select"
                                    Style="width: 210px;" Font-Bold="false" AutoPostBack="true" OnSelectedIndexChanged="ddlItem_SelectedIndexChanged">
                                </asp:DropDownList>
                            </ItemTemplate>
                            <FooterTemplate>
                                <asp:Label ID="lblTotalText" runat="server" Text="Total :"></asp:Label>
                            </FooterTemplate>
                            <ControlStyle Width="150px" />
                            <ItemStyle HorizontalAlign="Center" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="" ControlStyle-Width="0px" Visible="true">
                            <ItemTemplate>
                                <asp:TextBox ID="txtMRP" runat="server" Enabled="false" Visible="true" BorderStyle="None"
                                    BackColor="White" />
                            </ItemTemplate>
                            <ControlStyle Width="0px" />
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="" ControlStyle-Width="0px" Visible="true">
                            <ItemTemplate>
                                <asp:TextBox ID="txtAmount" runat="server" Enabled="false" Visible="true" BorderStyle="None"
                                    BackColor="White" />
                            </ItemTemplate>
                            <ControlStyle Width="0px" />
                        </asp:TemplateField>

                    </Columns>

                </asp:GridView>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ddlItem" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
        <br />

        <div style="margin-left: 50px; margin-top: 10px">
        </div>
        <br />
        <asp:Button ID="btnAddSalesOrder" runat="server" Text="Send Inquiry" OnClick="btnAddSalesOrder_Click"
            Style="margin-left: 30px; color: White; background-color: #088FCA;" OnClientClick="myClosure();"
            class="btn btn-info" />
        <asp:Button ID="btnPlaceOrder" runat="server" OnClick="btnPlaceOrder_Click" Text="Place Order"
            Style="margin-left: 30px; color: White; background-color: #088FCA;" OnClientClick="myClosure();"
            class="btn btn-info" />
        <asp:UpdateProgress ID="UpdtProgress" DisplayAfter="1" runat="server" EnableViewState="False">
            <ProgressTemplate>
                <div style="top: 0px; height: 120%; background-color: White; opacity: 0.75; filter: alpha(opacity=75);
                    vertical-align: middle; left: 0px; z-index: 999999; width: 120%; position: absolute;
                    text-align: center;">
                    <img src="Images/loader.gif">
                </div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>

<script type="text/javascript">
    $('.chzn-select').select2({
        no_results_text: 'Oops, nothing found!',
        allowClear: true,
        maximumSelectionSize: 1,
        width: '130px;'
    });

First thanks for reading. I have project .NET, the problem when I click menu. I try to enable Windows Authentication and to webconfig of Master Data Service. but still have this problem.

Image of problem

I'm using Asp.net ,

2957

https://pastebin.com/raw/Rf02nKuC Click on the Load button, two handsontable panels appear, including an empty table and a table containing data. How to display only 1 table with updated data. Pls!

See Im having a problem im using add in ajax

  handleSubmit(name, address,department){

 const laman = {
      'Employee_Name': name,
      'Address': address,
      'Department': department

    }
    return fetch('http://localhost:5118/api/employeedetails/PostEmployeeDetail?', {
        method: 'POST',
        headers: {
        'Content-Type': 'application/json'
        },
        body: JSON.stringify(laman)
    })
    .then(function(response) {
      console.log(response)

      return response.json();
    })
    .then((result)=> {
       var jsonReturnedValue = [...this.state.jsonReturnedValue];
       jsonReturnedValue.push(laman);
       this.setState({jsonReturnedValue})
       this.refs.Name.value="";
       this.refs.Address.value="";
       this.refs.Department.value="";
       // this.setState({ value: '' });
    })
    .catch(function(error) {
      console.log(error);

    })

but when it add new row it dont have an id because of it dont know what id to put.... but when i refresh it already had an id because it was added on the database and it was autoincreament in my sql.. id why here's a picturehere is the image

In VS2015 im using web application with OracleDB and i'm trying to do the connection with Entitydatasource wizard.Everything works fine and smooth even though i have EF6 but if any of the tables im trying to load has a Boolean type (number(1,0) in database) the wizard crashes(It says that its only compatible with ef5 etc..).

I tried to change the type from model properties to int16 but then project throws error for wrong mapping.I read somewhere that EntityDatasource recognize true or false for Boolean but its mapped by default from oracle to recognize Boolean as number(1,0). So i guess there is a conflict there.