My database is called: Baseball and the table i want to display is called: Players.

I made a database that has different baseball teams and different players from baseball teams.

For example in my Teams table the team name "Red Sox" has a teamID '2' that primary key is linked to the Players table under "team". Now I have a few players with '2' as their team.

I created a html file and want to display only the Players with 2 as the data shown under team.

Here is the code I have so far I keep messing with it. I finally got this which gives me no errors however I don't know how to write a function that displays it.

@{  
    var db = Database.Open("Baseball");
    var selectQueryString = @"SELECT firstname , lastname  FROM Players WHERE team = 2";    
}

I am using MVC 4 and kendo UI for grid population. But the grid is not populating correctly.

this is my View :

<script type="text/javascript">

        $.ajax({
            url: '@Url.Action("Employee_Read", "UserSummary")',
            type: 'GET',
            dataType: "json",
            Async: true,
            success: function (data, textStatus, xhr) {
                var dataloc = data;



                var element = $("#grid4").kendoGrid({
                    dataSource: {
                        data: dataloc,
                        schema: {
                            model: {
                                fields: {
                                    userDetailsId: { type: "number", editable: false },
                                    name: { type: "string", editable: false },
                                    roleId: { type: "string", editable: false },
                                    emailId: { type: "string", editable: false }
                                }
                            }
                        }
                    }
                });
            }
        });
    </script>

Conroller ;

 [HttpGet]
    public ActionResult Employee_Read([DataSourceRequest]DataSourceRequest request)
    {
        using (var emp = new MockProjectAkarshEntities1())
        {
          IQueryable<tbl_UserDetails> userDetails = emp.tbl_UserDetails;


            DataSourceResult result = userDetails.ToDataSourceResult(request);

            return Json(result,JsonRequestBehavior.AllowGet);


        }

In the output I am getting something like "[object][object]" and no of rows in the table returned from database.the skeleton of grid is coming but not the data. I am new to MVC and kendo. Please help me out.

Using ASP.NET MVC and Razor, I'm trying to pass a ViewBag item from the controller to a HiddenFor field (using Razor). I get the following message: Extension methods cannot by dynamically dispatched.

  @Html.HiddenFor(m=>m.PortfolioId, ViewBag.PortfolioId);

i have many exercise to execute by ASP.Net in Computer Graphic by do some practical work on it. my tutorial is about how to rotate,Reflect,shear,Translate,Scale.Can anyone helps me. I try to use many function of transformation but it doesn't work? need feedback immediately]1

I have an ASP.Net WebAPI application. There are currently two SQL Server databases:

identity database - holds all the Identity tables
app      database - holds all the application tables

I have two contexts and everything works okay.

I would like to combine the tables from the two databases. To put the identity tables into the app database.

Can I still have two contexts and just recreate the tables in the app database and point the connection string of the identity context and the app context to the same database?

I am working on xsl:fo for developing pdf's.

Here i have an issue is like, when i add image in the fo, the image is displaying a black block as image size in chrome, where it works fine in IE and firefox.

So please help me out for this issue, here below is code i have used for adding image.

                  <fo:table-cell text-align="left" padding-left="30px" padding-bottom="30px">
                  <fo:block>
                    <fo:external-graphic content-type="content-type:image/JPEG" src="" padding-top="15pt">
                      <xsl:attribute name="src">url(barcode1.jpg)</xsl:attribute>
                    </fo:external-graphic>
                  </fo:block>
                </fo:table-cell>

content-type="content-type:image/JPEG"

Thanks

Web application runs perfectly fine but after running for a bit, it stops feeding bundled CSS and js files. It start throwing 404 error. I clear the temp .Net files, and the site start to work normally. Again after a while it stops working.

What should I do ?

I need to keep the object on the top when page scrolling. I found the example on How to keep object on page scrolling with the top of the page. However when the page scrolling, the object change width. Can someone help me how to solve the problem. Thanks in advance

when the page load; the object it inside the fieldset. enter image description here

After scrolling the page, the object change the width. enter image description here

There is my code:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm2.aspx.vb"    
  Inherits="myProject.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  
        Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
   <head runat="server">
    <title></title>

    <script language="javascript" src="/include/jquery.js" type="text/javascript"></script>
     <style   type="text/css">

        #scroller {
           position: relative;
           top: 0px;
           width: 90%; 
           background: GREY;
           height: 120px;
          }

       .fixed { 
         position: fixed !important; 
          /*zoom:1; /* This enables hasLayout, which is required for older IE browsers */ 
        top: 0px !important;
       }
</style>

   <script type="text/jscript">

     $(window).scroll(function() {
        if ($(window).scrollTop() > 100) {
            $('#scroller').addClass('fixed');
        } else {
            $('#scroller').removeClass('fixed');
        }
    });

    </script>


</head>

  <body id="bdypopup" >
    <form id="Form2" runat="server">
        <div id="mainpopup" style="width:90%;"> 
            <fieldset class="fldBoxy " style="background-color:Red;">               

                <legend class="fldLegend" >Edit Order                     
                </legend>                
                <div id="scroller">
                <asp:Label ID="lblYear" runat="server"  Text="TESTING"></asp:Label>
                 <table width="98%"  >
                 <tr>
                 <td width="65%"> <asp:HiddenField ID="hdUnCheckRow" runat="server" />    </td>
                 <td> 
                    <asp:CheckBox ID="chkOne" runat="server"  Text="Show One"    Checked="true" Visible="true" />
                    <br />
                    <asp:CheckBox ID="ChkTwo" runat="server"  Text="Show Two"   checked="true" Visible="true"/>
                    <br />

                     </td>
                 </tr>
                 </table>

                <div >

                    <asp:button id="btnSave" runat="server" text="Save"  causesvalidation="true" OnClientClick="enableButton()"    UseSubmitBehavior="false" />&nbsp;                   
                    <button id="btnCancel" type="button" runat="server"  onclick="closeWindows()">Cancel</button> 

                </div>
                </div>
                 <asp:Literal ID="ltr" runat="server" />
                 </fieldset>
</div>
</form>
</body>
</html>

I'm using Visual Studio 2013 for web with MVC 5.

When trying to add a new controller to the "Controllers" map in my project, here's what I do: right click controllers, Add, New Scaffolded Item, "MVC 5 controller with views using EE". I fill in the Controller Name, Model class etc.. But the "Add" button is greyed out.

  • The project is selected.
  • I'm not in debugging mode
  • I'm able to add a class to Models folder

I have done lots of research and found that some times the name of the object can cause issues and so on. However I have (at least I think) determined that this is not an issue. Most of the issues I see people have is trying to convert enum to the dropdownlist, which I do not need.

I am using:

public enum PriorityTypeEnum
{
    Low = 1,
    Medium = 2,
    High = 3,
}

@Html.DropDownListFor(m => m.CurrentTicket.Priority, Model.PriorityList.SetSelectedItem((int)Model.CurrentTicket.Priority))

Which gets the list of all the Priorities, and sets the selected item to the CurrenTicket.Priority.

Now, the list itself that is returned is fine. The item that should be selected is, however nothing is selected in the DropDownListFor. After doing debugging if I change the type of the Priority from the enum (PriorityTypeEnum) to an int, it selects the right one. As you can tell, this is really annoying when I have an enum that holds the values.

My question is how to make it select properly and still use the enum?

I don't know if I am missing something very simple here. I have been looking at this way to long.

I have done lots of research and found that some times the name of the object can cause issues and so on. However I have (at least I think) determined that this is not an issue. Most of the issues I see people have is trying to convert enum to the dropdownlist, which I do not need.

I am using:

public enum PriorityTypeEnum
{
    Low = 1,
    Medium = 2,
    High = 3,
}

@Html.DropDownListFor(m => m.CurrentTicket.Priority, Model.PriorityList.SetSelectedItem((int)Model.CurrentTicket.Priority))

Which gets the list of all the Priorities, and sets the selected item to the CurrenTicket.Priority.

Now, the list itself that is returned is fine. The item that should be selected is, however nothing is selected in the DropDownListFor. After doing debugging if I change the type of the Priority from the enum (PriorityTypeEnum) to an int, it selects the right one. As you can tell, this is really annoying when I have an enum that holds the values.

My question is how to make it select properly and still use the enum?

I don't know if I am missing something very simple here. I have been looking at this way to long.

I m stucked here very much and it is going some serious.

I have a Gridview which I am using to show the data from the backend. What I did is For inserting the data, I have made a button on top of the Gridview to add the data in the gridview.

Like this:-

<asp:Button ID="btnAdd" runat="server" CssClass="btn btn-prm" Text="Add" Width="75" CausesValidation="true" ValidationGroup="AddNew" OnClick="btnAdd_Click" />

The same is been done for Edit part also.

I have added a checkbox to select the row for the gridview.See my gridview code for better understanding,

<asp:GridView ID="grdCSRPageData" runat="server" Width="100%" border="1" Style="border: 1px solid #E5E5E5;" CellPadding="3"
                AutoGenerateColumns="False" OnDataBound="grdCSRPageData_DataBound" AllowPaging="true" CssClass="hoverTable"
                OnPageIndexChanging="grdCSRPageData_PageIndexChanging" DataKeyNames="Id" OnRowDeleting="grdCSRPageData_RowDeleting" 
                PageSize="5" ShowFooter="true" OnRowEditing="grdCSRPageData_RowEditing" OnRowUpdating="grdCSRPageData_RowUpdating" 
                OnRowCancelingEdit="grdCSRPageData_RowCancelingEdit">
                <AlternatingRowStyle CssClass="k-alt" BackColor="#f5f5f5"/>
                <Columns>
                    <asp:TemplateField HeaderText="Action" HeaderStyle-Width="5%" HeaderStyle-CssClass="k-grid td" >
                        <ItemTemplate>
                            <asp:Checkbox ID="chkSelect" runat="server" AutoPostBack="false" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="page_title"  HeaderText="Page Title" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td"  />
                    <asp:BoundField DataField="page_description" HeaderText="Page Description" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" />
                    <asp:BoundField DataField="meta_title" HeaderText="Meta Title" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" />
                    <asp:BoundField DataField="meta_keywords" HeaderText="Meta Keywords" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" />
                    <asp:BoundField DataField="meta_description" HeaderText="Meta Description" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" />
                    <asp:BoundField DataField="Active" HeaderText="Active" ItemStyle-Width="30" HeaderStyle-CssClass="k-grid td" />
                    <asp:TemplateField HeaderText="Action" HeaderStyle-Width="15%" HeaderStyle-CssClass="k-grid td" >
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDelete" AlternateText="Delete" ImageUrl="~/images/delete.png" runat="server" Width="15" Height="15" CommandName="Delete" CommandArgument='<%# Eval("Id") %>' CausesValidation="false" OnClientClick="return confirm('Are you sure you want to delete this record?')" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ButtonType="Image" ItemStyle-Width="15" EditImageUrl="~/images/edit.png" ShowEditButton="True" ControlStyle-Width="15" ControlStyle-Height="15" CancelImageUrl="~/images/close.png" UpdateImageUrl="~/images/update.png">
                        <ControlStyle Height="20px" Width="20px"></ControlStyle>
                    </asp:CommandField>
                </Columns>
            </asp:GridView>

Now what my requirement is. Whenever I check the checkbox for any row, and click on the Update button, the repsective Row should get open in a popup with the existing data as it is getting for adding the new Row. I tried but couldn't succeed. Please help me with this. Let me know if you need anything else.

Thanks.!

I'm trying to configure routing in my application in such way: paths to files should work for every directory except one special. And access to files in this direcotory should be processed by my controller action. If I write smth like this:

routes.Map("Specialfolder/{name}", "Controller", "Action");

it works only for unexisting files. Controller doesn't catches route for existing file

If I add this line:

routes.RouteExistingFiles = true;

Working with files in my folder is ok. But files in other directories aren't routed anymore. How to fix this?

I'm using visual studio 2015 preview.

My solution structure is like this

/Solution
    Dummy.sln 
    /src
        /config
        /app
            Library1.kproj
            /Web.kproj
        /db
        /tests
            unitTests.kproj

My global.json file looks like this

{ "sources": [ "src" ] }

My "Web project" successfully had a reference to "library project". But my "unitTests project" fails to see the "library project" reference. Whenever I add a reference... it mistakenly resolves to:

C:\Users\UserAccount.kpm\packages\Library1\1.0.0

Which is wrong.

I tried few options ... none worked. Does global.json support folder paths ?

{ "sources": [ "src", ".\tests", ".\app" ] }

Any solutions other than changing the solution structure?

I have a WCF REST service using the webHttpBinding, and I am having some trouble getting it to work in a test environment behind an F5 load balancer - at least I believe the load balancer is an issue.

The service has been proven to run and operate locally using either http or https ("works on my machine"). The service is hosted in the same site that is consuming it.

Our test environment sits behind an F5 load balancer, which terminates SSL and forwards the request to server over http. Our IT staff has indicated that all incoming traffic to the test environment is http, and maintains that the site is configured with both http and https bindings in IIS. The only apparent difference between my local machine and the test environment is that my local machine is IIS 8 and the test environment is IIS 7.5.

The routes are registered like this:

RouteTable.Routes.Add(new ServiceRoute("REST/stuff", new WebServiceHostFactory(), typeof(StuffService)));

Currently, this is the relevant config that works locally:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true">
      <security mode="Transport"/>
    </standardEndpoint>
  </webHttpEndpoint>
</standardEndpoints>
<bindings>
  <webHttpBinding>
    <binding>
      <security mode="Transport"/>
    </binding>
  </webHttpBinding>
</bindings>
 <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
            </behavior>
        </serviceBehaviors>
 </behaviors>

Initially, this service was deployed to the test environment without SSL, and I received this error when accessing a page that utilized the service:

Mixed Content: The page at 'https://foo.bar.com/thing.aspx' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://foo.bar.com/REST/stuff/'. This request has been blocked; the content must be served over HTTPS.

That seems mysterious to me now, since the site was accessed over https, and the call to the service was using a relative URL. Unfortunately, I cannot debug this now since I changed the configuration.

At the time I received the error above, I did not know about the F5, and figured that all I needed to do was to configure my service to use transport security, as in the above configuration. After changing configuration to use transport security, the service fails to activate in the test environment, initiating this error on the server:

The service '/REST/stuff' cannot be activated due to an exception during compilation. The exception message is: Could not find a base address that matches scheme https for the endpoint with binding WebHttpBinding. Registered base address schemes are [http].

This, I believe, indicates that the service is expecting to operate using https, but the lack of https in registered base address schemes is preventing that, so the service cannot initialize at all. I understand that this may happen when the https binding is missing in IIS (though IT maintains it is not).

I am not sure what else I can do to enable my use case. Any help is greatly appreciated!

When there are lots of data to display on grid from database then the loading time might become an issue. For sometimes user might want to ABORT the data filling. I am using RadGrid and want to handle this scenario using a button. When the button is pressed the data filling will be aborted.I am using Ajax for filling the data into the grid. Can you please suggest me something to achieve this behavior ?

i am trying to implement the dhtmlx scheduler into my project

on the timeline scheduler, the format for generataing the Y axis is

  elements = "[{ key: 1, label: 'Food', open: false, children: [{ key: 211, label: 'Burger' }]}]";

So I tried to load custom Y axis value from my database using JQuery Ajax:

menu.aspx:

$.ajax({
    type: "POST",
    url: "menu.aspx/get_menu",
    contentType: "application/json",
    dataType: "json",
    success: function (msg) {
        window.elements = msg;
    }
});

backend:

[WebMethod(EnableSession = false)]
public static object get_menu()
{
    return "[{ key: 1, label: 'Food', open: false, children: [{ key: 211, label: 'Burger' }]}]";
}

When I use this code, the data is empty.

However if I use:

$.ajax({
    type: "POST",
    url: "menu.aspx/get_menu",
    contentType: "application/json",
    dataType: "json",
    success: function (msg) {
        window.elements = [{ key: 1, label: 'Food', open: false, children: [{ key: 211, label: 'Burger' }]}];
    }
});

It works like a charm. Is there a difference in these 2? And what can be done to fix this error

Still in way over my head. Don't be too mean!

I'm connecting to an ASP API from PHP through a SoapClient and having trouble passing an argument to one of the methods. That said, I receive the failure result and am able to parse them (thanks @AbraCadaver!) successfully, so I'm not barking up the wrong tree - just climbing it wrong! I can also confirm that manually entering in the key on the API page works, so I've got the correct data.

Based on the following WSDL, am I formatting the security key correctly?

My PHP:

$loginResult = $soapClient->Login($securityKey);

Their WSDL:

<s:element name="Login">
    <s:complexType>
        <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="SecurityKey" type="s:string"/>
        </s:sequence>
    </s:complexType>
</s:element>

FWIW, from their API page:

Login 
This function authenticates the user.

Parameters (* required):
SecurityKey*:   Security Key

I want to control and send my data by Ajax .but on click event does not work.my code works in website but I have problem in Webform Web application .what is the problem?

I've so far implemented several custom multi-tenant providers for Azure Table Store like a ASP.NET Session-state provider, ASP.NET Virtual Path Provider, a.s.f. I would now like to implement a custom multi-tenant ASP.NET Application-State provider, but I have not found any resources or best practices online.

In the example below I show how I would like to use the ASP.NET Application-State provider to keep track of number of online users across all my Azure Web application nodes:

void Session_Start(object sender, EventArgs e)
{
    Application["NumOnlineUsers"] = ((int)Application["NumOnlineUsers"] + 1);
}

void Session_End(object sender, EventArgs e)
{
    Application["NumOnlineUsers"] = ((int)Application["NumOnlineUsers"] - 1);
}

How can I implement a ASP.NET Application-State Provider where I persist the application-state data in the Azure Table Store?

I am trying to find a tool that can be used to create PDFs from websites. These websites all have Bootstrap based client side view settings, such as tabs, toggles, and paging. As such, there is no post-back to the server. I need to be able to create a pdf that is in the same state as the user sees it.

In my research, I have only been able to find tools that can create PDFs if given a URL, or if given a HTML string. Examples of these tools include ActivePDF's Webgrabber, and EVO PDF. However, they are not able to generate the PDF's with the client-specific settings, but instead only see the default selections of a given page. It is not possible for me to do a post-back to the server, so I am looking for a tool that can create PDFs on the fly, with the dynamic settings intact. I am working in ASP.NET, and so I would like a tool that is .NET friendly as well. Lastly, I would prefer the tool to not be open-sourced.