I am trying to integrate razorpay in my angualar project

here is the code

<form action="/purchase" method="POST">
<!-- Note that the amount is in paise = 50 INR -->
data-name="Merchant Name"
data-description="Purchase Description"
data-prefill.name="Harshil Mathur"
<input type="hidden" value="Hidden Element" name="hidden">

But in angular js is not executing this code Please help me

I am trying to add minDate and maxDates in datepicker of BeyondAdmin Theme not simple jquery datepicker, but it's not working. Following is myjquery code to set dates :

<script type="text/javascript">
         format: 'dd/mm/yyyy',
         minDate: new Date(),
         maxDate: new Date(),

and I have used razor syntax like this

@Html.Bootstrap().TextBoxFor(t => t.EntryDate).Id("id-date-picker")

Date Format is working fine but not min and max Dates. Has somebody used this theme, can somebody please help me out? Thank you

I created a custom TextBoxFor method to ease my development in razor, using a custom "InputField" class on my ViewModel.


public enum FieldState

public class InputField
    public FieldState State
        internal set;

    public string Value
        private set;

    public InputField()
        State = FieldState.NORMAL;
        Value = string.Empty;

    public override string ToString()
        return Value;

    public static implicit operator string(InputField field_)
        return field_.Value ?? string.Empty;

public class PrintJobForm
    public InputField Material


public static MvcHtmlString ClassedTextBoxFor<TModel, TProperty>(
    this HtmlHelper<TModel> html_,
    Expression<Func<TModel, TProperty>> expr_,
    string classes_ = "")
    where TProperty : InputField
    classes_ += " form-control";

    if (expr_.Compile().Invoke().State == FieldState.DISABLED) {
        classes_ += " disabled";

    return html_.TextBoxFor(expr_, new {
        @class = classes_


<div class="control-group">
    <div class="col-md-3">
        @Html.ClassedTextBoxFor(model_ => model_.Material)
        @Html.ValidationMessageFor(model_ => model_.Material)

I think what I want to do is pretty straight forward. The current problem is this line

if (expr_.Compile().Invoke().State == FieldState.DISABLED) {
    classes_ += " disabled";

The Invoke() requires an argument of type TModel. How can I get this from the expression, so I can correctly set the "disabled" state in HTML?

In my task i want to do spell check by showing suggested words in drop down list. I am OK with doing spell check but i am getting suggested words on right click, my requirement is I want to show them in drop down list(without using right click). I know it is possible by writing jquery but I am new to it. I need some help in writing jquery. I am using ASP.NET MVC 5 using razor engine and for spell check I am using 'aspnetspell'.

Any detailed suggestions are appreciated.

I've this section in vbhtml :

<section class="white">
    @For Each item In Model
        @<div class="BNItem">
            <p class="title">@Html.DisplayFor(Function(modelItem) item.Titre)</p>
            <p class="description">@Html.DisplayFor(Function(modelItem) item.Description)</p>
            <!-- Your share button code -->
            <div class="fb-share-button" data-href="http://..." data-layout="button_count"></div>
            <hr />

This creating as many that there are item in the model. For each item I want to share the content of the two <p> with the facebook's script :

 <script type="text/javascript">
        $(document).ready(function () {
            $('.fb-share-button').live('click', function (e) {
                    method: 'feed',
                    name: 'HyperArts Blog',
                    link: 'http://...',
                    picture: 'http://...',
                    caption: 'title', //first <p> content
                    description: 'description', //second <p> content
                    message: ''


How can I achieve that ? Or which way do you recommend? Thanks in advance.

I am new in MVC and struggling to use below code in controller.

List<DataRow> Qd = new List<DataRow>();
Qd = new List<DataRow>(dt.AsEnumerable().SelectMany(r => r.DataRow));

When I am compiling getting error:

'System.Data.DataRow' does not contain a definition for 'DataRow' and no extension method 'DataRow' accepting a first argument of type 'System.Data.DataRow' could be found (are you missing a using directive or an assembly reference?).

I am not sure what I am missing.

I have a search view with two textboxes and their search buttons.

@using MyProject.Web.Controllers
@model IEnumerable<MyProject.Web.Models.ResultViewModel>
@{int searchType = 0;}

    ViewBag.Title = "SearchPlaceHome";

<div id="searchBox" class="panel panel-primary">
    <div class="panel-heading">Search for:</div>
    <div class="panel-body">
        <div class="row">
            <div class="col-lg-12">
                <form method="get">
                    <div class="input-group" style="width: 310px">
                        @{searchType = (int)SEARCH_TYPE.UNIT_ID;}
                        @Html.HiddenFor(t => searchType)
                        @Html.TextBox("searchString", "", new { placeholder = "Enter UnitId here...", style = "width: 230px; height: 28px;" })
                        <input id="unitSearchBtn" type="submit" value="Go!"/>
        <div class="row" style="margin-top: 10px;">
            <div class="col-lg-12">
                <form method="get">
                    <div class="input-group" style="width: 310px">
                        @{searchType = (int)SEARCH_TYPE.SP_NUMBER;}
                        @Html.HiddenFor(t => searchType)
                        @Html.TextBox("searchString", "", new { placeholder = "Enter SP-Number here...", style = "width: 230px; height: 28px;" })
                        <input id="spNumberSearchBtn" type="submit" value="Go!"/>

My controller has this method

        public ActionResult SearchPlace(int searchType = 0, string searchString = "")
            var results = new List<ResultViewModel>();
            //some code here...
            return View("\\Places\\SearchPlace", results);

and the enum looks like

 public enum SEARCH_TYPE : int
     NA = 0, UNIT_ID = 1, SP_NUMBER = 2

the problem is, that only the searchString changes...regardless which button is clicked.

unitBtn click -> http://localhost/?searchType=1&searchString=unit123

spNrBtn click -> http://localhost/?searchType=1&searchString=sp456

When i rename the first ActionResult parameter int searchType, than the created urls are correct but ofc donĀ“t pass the SEARCH_TYPE parameter.

unitBtn click -> http://localhost/?searchType=1&searchString=unit123

spNrBtn click -> http://localhost/?searchType=2&searchString=sp456

Furthermore both textboxes get filled with the searchString because they have to be named the same for passing the searchString .

My View is:

@if (Model.daily == "SD")
    <div  id="selected_days">
        <div class="row">
            <div class="form-group">
                <div class="inline">
                    <label class=".col-xs-2 col-sm-2 col-md-2 col-lg-2">Select Reminder Days</label>
                    <div class=".col-xs-8 col-sm-8 col-md-8 col-lg-8">

    @Html.DropDownListFor(model => model.day,
        new List<SelectListItem>{
            new SelectListItem(){ Value="Monday", Text = "Monday" },
            new SelectListItem(){ Value="Tuesday", Text = "Tuesday" },
            new SelectListItem(){ Value="Wednesday", Text ="Wednesday"},
            new SelectListItem(){ Value="Thursday", Text ="Thursday"},
            new SelectListItem(){ Value="Friday", Text ="Friday"},
            new SelectListItem(){ Value="Saturday", Text ="Saturday"},
            new SelectListItem(){ Value="Sunday", Text ="Sunday"},
        }, new { @id = "my-select", @multiple = "multiple" })


I want to print Selected=true after "Text=Monday" etc based on a variable's value. When I am writing @Model.myvariable, it is giving error. I wrote Response.write(myvariable) still gives error. Now I don't know how can I write it based on my if statement. I am new in using razor and I am unable to understand this at all. I have searched, but there is no good solution for it anywhere.

My list consist of all the days in it, the code is:

List<string> days = myDataReader.GetString(11).Split(',').ToList<string>();

Now I want that if the list consist of Monday, Tuesday and so on, accordingly Selected=true should be displayed

I am having a problem with dataformatting in SQL, C#, Razor and HTML5

In my database is a field which has to represent a currency, however the datatype is decimal(18,2), every value saved to the database is saved with an decimal point.

In my DTO the type is also decimal.

However when i give the EditorFor the type number, the field is null when it loads the page. When i give the EditorFor the type money, the field is filled with the correct value, however it places an comma instead of an decimal point which let it kick in an validation error when the form submits. I have to manually change the comma to an decimal point for it to correctly submit.

I have allready tried setting the type of the EditorFor to number and setting the step property but then it still keeps my input empty.

record in database
This is the record in the database

record on page
This is the record in my view

html markup
this is the generated html markup

UPDATE: I changed the globalization settings to en-US, this fixed the comma to decimal point question but screws up my date annotation, so down the line i'd like the data annotation to be nl-NL (or similar) and the number format to be en-US (or similar)

Note: it is not allowed to make any changes to the database regarding data-types.
Note: debugging is done on Google Chrome and Microsoft Edge

I'm working in a project using MVC 6.

When looping through a collection of items inside a form in my view default validation attributes are added to one (seemingly random) of the generated tags, even though no data annotations are set.

There are three generated input tags at the moment, and sometimes the first one gets data-val, data-val-number, and data-val-required added to it, and sometimes the second, but only one at any given time.

From what I've understood required and type restriction might be added because of not-nullable properties and the type of the properties, but even so, why does this only happen to one of the items?

I'm not using any javascript (while trying to figure this out).

I am working in mvc project where I want to generate one gridview(html table). The headers should bind from db and data also should bind from db dynamically. This is my metadata or master table.

Id      Name    Label           Value         Emp_id
31      Adhar   DocumentNumber  12345678       1
32      Adhar   ExpiryDate      1/1/2015       1
33      Pan     DocumentNumber  123456789      2
34      Pan     ExpiryDate      1/1/2015       2
36      Pan     IssueLoc        India          2

and my table should be like this below. if the input parameter emp_id is 1 then table should look like below. This is HTML

<Table><tr><th>DocumentNumber</th><th>ExpiryDate</th><td>12345678       </td>1/1/2015<td></td></tr></table>

OR this is plain web sheet.

DocumentNumber   ExpiryDate
12345678         1/1/2015 

I am working in mvc4 entity framework. How to overcome from this? Can anybody give me some idea to solve it. I have googed across and found nothing. Please provide me some idea. If question is uncleared please let me know

This is for emp_id with 2

DocumentNumber   ExpiryDate  IssueLoc
12345678         1/1/2015    India

I am calling two fields from two datatables (IncDate and ExpDate). They are stored as dd/MM/yyyy and when I make my sql call to the database, I use Order by Convert(DATETIME, IncDate, 103) to have the dates in order. I do this for each of my IncDate and ExpDae columns. I add each of these into a string array by using:

 var stringArr = Dt.AsEnumerable().Select(r => r.Field<string>("IncDate")).ToArray();
var stringArr2 = Dt2.AsEnumerable().Select(r => r.Field<string>("ExpDate")).ToArray();

The problem comes when I try to merge the two together into one string array. I do this by using:

string[] combined = stringArr.Concat(stringArr2).ToArray();

although this is just adding the dates randomly. I would like to have the dates combined and ordered in the combined string but I'm not sure how to do this.

So for example in IncDate I might have (01/03/2016, 02/03/2016, 03/03/2016, 06/03/2016) and in ExpDate i might have (02/03/2016, 03/03/2016, 04/03,2016) and when I combine them they should be in the order (01/03/2016, 02/03/2016, 02/03/2016, 03/03/2016, 03/03/2016, 04/03/2016, 06/03/2016)

Cheers in advance!

I have simple DataTable

CREATE TABLE [dbo].[Table] (
[Id]   INT        IDENTITY (1, 1) NOT NULL,
[Name] NCHAR (10) NULL,

With one record, Name="Test" Id get's automatic 0.

When I am using basic create operation

public ActionResult Create(Table table)
    if (ModelState.IsValid)
        return RedirectToAction("Index");

    return View(table);

I get error:

Cannot insert explicit value for identity column in table 'Table' when IDENTITY_INSERT is set to OFF.

What I am doing wrong? How to fix this error?

Table class

public partial class Table
    public int Id { get; set; }
    public string Name { get; set; }

I am using the membership provider with ASP.NET. The maximum length of a UserName is 50. Is there a way to increase it?

I've already tried to increase the column size in the db but MemberShip.CreateUser fails for long usernames with a ProviderError

i've an HTTP Response's string that represents an image. I should insert (and show) this image in a ASP's Image Web Control.

So, i get the image's string:

Public Shared Function ExecuteGet(ByVal sUrl As String, ByVal sData As String, ByVal dcHeaders As Dictionary(Of String, String)) As String

    Dim sResponse As String = String.Empty

    ' Create a request using a URL that can receive a post. 
    Dim request As WebRequest = WebRequest.Create(sUrl)
    ' Set the Method property of the request to POST.
    request.Method = "GET"
    ' Create POST data and convert it to a byte array.
    Dim getData As String = sData
    Dim byteArray As Byte() = Encoding.UTF8.GetBytes(getData)
    ' Set the ContentLength property of the WebRequest.
    request.ContentLength = byteArray.Length
    ' Set Headers
    For Each item In dcHeaders
        request.Headers.Add(item.Key, item.Value)
    ' Get the response.
    Dim response As WebResponse = request.GetResponse()
    ' Get the stream containing content returned by the server.
    Dim dataStream As Stream = response.GetResponseStream()
    ' Open the stream using a StreamReader for easy access.
    Dim reader As New StreamReader(dataStream)
    ' Read the content.
    Dim responseFromServer As String = reader.ReadToEnd()
    ' Display the content.
    sResponse = responseFromServer
    ' Clean up the streams.

    Return sResponse

Now, how can i insert this response's string in the web control?

This question already has an answer here:

     protected void Binddropdown()

        SqlConnection con = new SqlConnection(te);
        SqlCommand cmd = new SqlCommand("select * From country", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        DropDownList1.DataTextField = "cou_Name";
        DropDownList1.DataValueField = "cou_id";
        //trying to use second DataValueField
        DropDownList1.DataValueField = "cou_Image";

        DropDownList1.DataSource = ds;
        DropDownList1.Items.Insert(0, new ListItem("Select","0"));

    public void BindTitle()
       foreach (ListItem li in DropDownList1.Items)
        { li.Attributes["title"] = li.Value; }
    protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)

        **Label1.Text = DropDownList1.SelectedValue;**


        **int couid = Convert.ToInt32(DropDownList1.SelectedValue);**

        SqlConnection con = new SqlConnection(te);
        SqlCommand cmd = new SqlCommand("SELECT * from province where province.cou_id=" + couid, con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        DropDownList2.DataTextField = "pro_Name";
        DropDownList2.DataValueField = "pro_id";
        DropDownList2.DataSource = ds;
        DropDownList2.Items.Insert(0, new ListItem("Select", "0"));

Help me how I can Use two DataValueFiled for showing image flags in country dropdown list . help me please

I have a table filled dynamically has a checkBox Column store every application ID and column has a dropdownlist filled dynamically in c#.

I have a Javascript function that check the input checkbox to get the application ID for every row I want also get the option values for the dropdownlist for the same row . how can I get this

here is my try Html

  <td style="text-align:center;">
    <asp:CheckBox ID="cbxSelectItem" runat="server"></asp:CheckBox>
   <b><a class="text-primary" style="text-decoration: underline" href="<%# String.Format(ESERV.UIWeb.Code.Settings.VirtualDirectory +"Pages/ServiceItems/DisplayServiceOnly.aspx?id={0}", Eval("Application.ApplicationId"))%>">  <%# Eval("Application.ApplicationId") %></a> </b>
  <td><b class='<%# Eval("Application.FinishDate") != null ? "text-green" :"text-orange4" %>'>
    <%# Eval("Application.FinishDate") != null ?Resources.Service.StatusFinish :Resources.Service.StatusUnderProcess  %>
      <a data-toggle="modal" class="text-primary" style="text-decoration: none; white-space:nowrap;" href='<%= ESERV.UIWeb.Code.Settings.VirtualDirectory %>Pages/ServiceItems/ApplicationSteps.aspx?id=<%#Eval("Application.ApplicationId") %>' data-target="#mdlApplicationSteps">
  <td class="text-center">
    <div class="col-md-12 btn-group">
      <div class="col-md-12">
        <asp:Label ID="lblUSerJobUnitID" runat="server" Text="" Visible="False"></asp:Label>
        <asp:Label ID="lblPendingFields" runat="server" Text="" Visible="False" ForeColor="Red" Style="text-decoration: underline"></asp:Label>
        <asp:DropDownList ID="ddlActions" CssClass="form-control chosen_list" runat="server" DataValueField="ActionTypeId" DataTextField="Name"></asp:DropDownList>
        <asp:Button ID="btnSubmitAction" runat="server" Text="<%$ Resources:Security,Save %>" class="btn btn-info btn-gradient" Visible="False" />

var selectedCheckboxs = $("#datatable2 input:checkbox[id*='cbxSelectItem']:checked");
if (selectedCheckboxs.length > 0) {
  $(selectedCheckboxs).each(function () {
    var appId = $(this).attr("appId");
    ShowActionPanel(appId, element);

I have a table where each row only contains two columns but the last row I am trying to put 3 columns into the table. But the third columns sticks out of the table

enter image description here


        <td colspan="2" id="tdPrintArea" runat="server">
          <table class="tblPrint"  runat="server" id="tblMain">
           <asp:Label runat="server" ID="lblPlaceAndDate" Font-Bold="true" Text="Place and date"></asp:Label><asp:Label ID="Label11" runat="server"></asp:Label>  
           <br /><br /><br />
           <asp:Label runat="server" ID="lblDate2" Font-Bold="true" Text="Date : "></asp:Label><asp:Label ID="Label13" runat="server"></asp:Label>  <br />
           <td > 
                <asp:Label runat="server" ID="lblSignShipper" Font-Bold="true" Text="Signature Shipper"></asp:Label>
                    <br />
               <asp:Label runat="server" ID="lblSignDriver" Font-Bold="true" Text="Signature driver"></asp:Label>
                       <br />
                 <asp:Label runat="server" ID="lblSignConsignee" Font-Bold="true" Text="Signature consignee"></asp:Label>
                <br />

How to get the row to display the 3 columns within the table?

I am trying to develop a webpage where the user is giving online test and if he has not submitted that test and then try to navigate to another page, he should get a confirmation message that his answers will not be saved if he leaves his test. How shall i go?


Build a PDF file which represents single C# class object with multiple fields and properties, that is created in runtime. It constains plain text, variables, tables, images.

What I have to use?

As a requirement, I have to render PDF report with Microsoft.Reporting.WebForms.LocalReport and it will probably contain SubReports.

What I did?

When working with reports until now, following simple pattern was enough:

ReportParameter param = new ReportParameter();
param.Name = "Param name";

but in that case I'd have to make over 80 parameters and I think it's just not a nice way, so I'm curious if there is better way to do that. Based on my researchers on SO and google, I can use System.Data.DataSet to achieve what I want, but:

  • It is only sightly better that hardcoding all the parameters
  • It is almost the same, but I produce additional files, IMO it's easier to use and understand ReportParameter way for future code users than getting burried in tons of extra files, that(maybe) could have been avoided
  • DataSets are for tabular data; I have one big model


Actually, I think the problem lies in DataSource of the RDLC report itself. The ways that VS provides are created for DB connection or any DB related object. That's why using DataSources and DataSets is indicated. I can provide any data that is either of type IEnumerable or IReportData (or from db connection), but mine are neither. I got my model already build and I'd want to use it if possible. Most examples I found was for creating reports straight from database or custom data sets. Got no more ideas how to make it work. That's why I'm here.

I'm creating a register page . When I write connection string to connect to SQL Server 2014 , this error is shown: Error Pic

protected void btnsignup_Click(object sender, EventArgs e)
    SqlConnection con = new SqlConnection("server=(local);DataBase=MyDataBase;integrated security=True");
    SqlCommand cmd = new SqlCommand("insert into Users (Username,UPassword,Uname,UEmail) values ('"+ tbUname.Text + ","+ tbPass.Text + ","+tbname.Text +","+ tbemail.Text +"')");