Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all 3938 articles
Browse latest View live

Build API in ASP.NET Web Form

$
0
0
Dear All,
 
I have no experience to build API before at all.
 
I'm using ASP.NET Web Form with C#.
 
How to start?
 
Thanks,

mvc 4 Ajax.BeginForm with Web API?

$
0
0
vs 2013 express for web
 
I have an MVC 4 web app and a WebAPI service returning JSON formatted data.
 
I tried to use Ajax.BeginForm to call the WebAPI service.
 
It does call it correctly
 
@model IEnumerable<MyApp.Models.SomeClass>
 
@using (Ajax.BeginForm(
            new AjaxOptions
            {
                HttpMethod = "get",
                Url="api/MyWebAPI",
                InsertionMode = InsertionMode.Replace,
                UpdateTargetId = "Resultlist"
            }))
{
 
    <div class="row">
        <div class="col-lg-12">
            <h3>Service Call Details - Method A</h3><inputtype="submit"class="btn btn-default"value=" Get Via Asynch Method A "/></div></div>
}
<divid="ResultList"><tableclass="table"><tr><th>
                @Html.DisplayNameFor(model => model.Name)
            </th><th>
                @Html.DisplayNameFor(model => model.Caption)
            </th><th>
                @Html.DisplayNameFor(model => model.Description)
            </th><th>
                @Html.DisplayNameFor(model => model.Active)
            </th></tr> 
        @foreach (var item in Model)
        {
            <tr><td>
                    @Html.DisplayFor(modelItem => item.Name)
                </td><td>
                    @Html.DisplayFor(modelItem => item.Caption)
                </td><td>
                    @Html.DisplayFor(modelItem => item.Description)
                </td><td>
                    @Html.ActionLink("Edit", "Edit", new { id = item.ClassifierGroupId }) |
                    @Html.ActionLink("Details", "Details", new { id = item.ClassifierGroupId }) |
                    @Html.ActionLink("Delete", "Delete", new { id = item.ClassifierGroupId })
                </td></tr>
        }
 
    </table> 
</div> 
 
But the results don't fill the form.
 
Now, when the data came from the Home controller's Index function, that returned data as a View with model as an ActionRequest...:
 
 
      public ActionResult Index()
        {
            ViewBag.Title = "Home Page";
 
            IEnumerable<SomeClass> model = db.SomeClasses.ToList();
 

            return View(model);
        }
 
So how do I convert the WepAPI returned JSON data to something that the razor form can use for the Model data?
 
Any help appreciated.
 
GS Sniff | :^)
GaltSalt
maker of .Net thingys

Click Event in Menu Control not firing

$
0
0
I have a Menu Control in my ASP.Net page. The click event is not firing. Can anyone help me why the event is not firing.

HHHEEEEEELLLPP!! - async WebAPI call never returns

$
0
0
Quick question..
I have WebAPI - like /api/SomeName
 
Called directly in my browser, it works - it returns JSON results.
 
I want to call WebAPI asynchronously.
using (HttpClient httpClient = new HttpClient())
{
    string response = await httpClient.GetStringAsync("/api/SomeName");
    return response;
}
 
But the GetStringAsync NEVER returns! Aaaarrrg
 
Is this the correct way to call it - of should I do something else?
 
Any tips? Advice? Hints?

maker of .Net thingys

list of ASP.NET SMS Gateways

$
0
0
plz give the free sms gateway for asp.net , Gateway like http://ubaid.tk
The above mentioned gateway is not currently working so i am asking u sir.
 
Sir, I Hope u will give the correct solution for my Question.

asp.net with c#

$
0
0
how to convert value date-time ?

c# windows application

$
0
0
( month and year )searching are date-time query in sql-server Plz Help

converting a DateTime object to a JSON date value

$
0
0
Hi,
 
I have a DateTime object in my app.
I need to turn this value into a JSON date field value like the one MicrosoftAjax.js does i.e.
/\Date(1312312312-700)\/
 
How do I explicitly do it on the server side?
 
Thanks.

What will be the best protocol and server to use?

$
0
0
I have the following requirement.
 
1. Send GPS location to server in real time.
2. Send error data and log to server in real time.
3. Send realtime video data to server.
 
As I am a embedded developer not much knowledge about server technology and protocols.
 
For requirement 1 and 2 I guess it can be done with simple HTTP server. But not sure if
real time video data can be sent to HTTP server.
 
Please suggest a good technology.
Regards
Anil

Bind multiple datatable to report in reportviewer

$
0
0
I can bind a single datatable which return from my SP. But If my SP returns multiple data tables, I can't bind all those data table into my dataset on DataSet.xsd page. How can i Bind it on My DataSet.xsd page. Can anyone help please

how to huge data processing in entity framework using mvc?

$
0
0
hi,
 
how huge data processing in entity framework and where the data stored in mvc.

ASP.net E-commerce system

$
0
0
My client has commissioned a project to create a custom eshop. This project has a lot of customization to be done if i use a ready solution (Nopcommerce etc). Also the list of products will be great. Which platform do you recommend for such a project? Basically I want to do customization of both the frontend and the backend.
 
Thank you

Regarding Paypal integration

$
0
0
Hi Friends,
I'm new to paypal, one of my application is integrated with paypal(testing site ie, sandbox). I need to use the actual live URL in the application with new live account.
For creating new account: Do i need to create directly business account or developer account and then business account?

Assign code behind value to and in Grid View

$
0
0
hi all,
 
I am using a GridView in my aspx page I want make the fields editable or non editable depending upon a field in page Code behind and another thing is that the bound column is also not getting values that I am assigning for code behind. Can anybody please look into my code and let me know, where am I doing mistake.
Please help me by giving suggestion where am I doing mistake or by showing any link for example. I am also researching regarding this. Any kind of help is appreciated. thanks in advance. For assigning values both the "" and '' aren't working I don't know why?
 
Here is my aspx html code:
<asp:GridView ID="gv1" runat="server" AutoGenerateColumns="False"
                OnRowEditing="gv1_RowEditing" OnRowCancelingEdit="gv1_RowCancelingEdit"
                OnRowUpdating="gv1_RowUpdating" CellPadding="4" ForeColor="#333333">
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <Columns>
                    <asp:CommandField ShowEditButton="True" />
                    <asp:BoundField DataField="RecipientAgency" HeaderText="Recipient Agency" InsertVisible="False"
                        ReadOnly="True" SortExpression="RecipientAgency" />
                    <asp:TemplateField HeaderText="Carry Over Year" InsertVisible="False" SortExpression="CarryOverYear">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtCarryOverYear" runat="server" Visible="<%# IsInEditMode %>" Text='<%# Bind("CarryOverYear") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblCarryOverYear" runat="server" Visible='<%# !(bool) IsInEditMode %>' Text='<%# Bind("CarryOverYear") %>'></asp:Label>
                            <asp:TextBox ID="txtCarryOverYear" runat="server" Visible="<%# IsInEditMode %>" Text='<%# Bind("CarryOverYear") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Diverted Year" InsertVisible="False" SortExpression="DivertedYear">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtDivertedYear" runat="server" Visible='<%# IsInEditMode %>' Text='<%# Bind("DivertedYear") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblDivertedYear" runat="server" Visible='<%# !(bool) IsInEditMode %>' Text='<%# Bind("DivertedYear") %>'></asp:Label>
                            <asp:TextBox ID="txtDivertedYear" runat="server" Visible='<%# IsInEditMode %>' Text='<%# Bind("DivertedYear") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Jul" SortExpression="Jul">
                        <EditItemTemplate>
                            <asp:TextBox ID="txtJul" runat="server" Visible='<%# IsInEditMode %>' Text='<%# Bind("Jul") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblJul" runat="server" Visible='<%# !(bool) IsInEditMode %>' Text='<%# Bind("Jul") %>'></asp:Label>
                            <asp:TextBox ID="txtJul" runat="server" Visible='<%# IsInEditMode %>' Text='<%# Bind("Jul") %>'></asp:TextBox>
                        </ItemTemplate>
                    </asp:TemplateField>
 </Columns>
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#999999" />
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            </asp:GridView>
And Here is my code behind code that tries to manipulate the gridview appearance and values:
publicpartialclass MonthlyPerformance : System.Web.UI.Page
    {
        protectedbool IsInEditMode=false;
       
 
        protectedvoid gv1_RowEditing(object sender, GridViewEditEventArgs e)
        {
            IsInEditMode = true;
            var temp = ((TextBox)gv1.Rows[e.NewEditIndex].FindControl("txtCarryOverYear"));
            var t=temp.Visible;// = IsInEditMode;
        }
 
        protectedvoid gv1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
        {
            IsInEditMode = false;
            e.Cancel = true;
        }
 
        protectedvoid Page_Load(object sender, EventArgs e)
        {
            LoadList();
        }
 
        protectedvoid gv1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
        }
        privatevoid LoadList()
        {
            string strSQL;            
            DataSet ds = null;            
            IDataReader dr = null;
            double Total = 0;
 
            DataSet dsByHand = new DataSet();
            dsByHand.Tables.Add();
 
            //ds.Tables[0].NewRow();
//dsByHand.Tables[0].Rows.Add(dsByHand.Tables[0].NewRow());

            dsByHand.Tables[0].Columns.Add("RecipientAgency");
            dsByHand.Tables[0].Columns.Add("CarryOverYear");
            dsByHand.Tables[0].Columns.Add("DivertedYear");
            dsByHand.Tables[0].Columns.Add("Jul");
            dsByHand.Tables[0].Columns.Add("Aug");
            dsByHand.Tables[0].Columns.Add("Sep");
            dsByHand.Tables[0].Columns.Add("Oct");
            dsByHand.Tables[0].Columns.Add("Nov");
            dsByHand.Tables[0].Columns.Add("Dec");
            dsByHand.Tables[0].Columns.Add("Jan");
            dsByHand.Tables[0].Columns.Add("Feb");
            dsByHand.Tables[0].Columns.Add("Mar");
            dsByHand.Tables[0].Columns.Add("Apr");
            dsByHand.Tables[0].Columns.Add("May");
            dsByHand.Tables[0].Columns.Add("Jun");
            dsByHand.Tables[0].Columns.Add("TotalProductProduced");
            dsByHand.Tables[0].Columns.Add("TransfToState");
            dsByHand.Tables[0].Columns.Add("Adjustment");
            dsByHand.Tables[0].Columns.Add("EndingBalance");
            var tempr = dsByHand.Tables[0].NewRow();
            tempr.ItemArray[0] = "Test Temp";
            dsByHand.Tables[0].Rows.Add(tempr);
 
            gv1.DataSource = dsByHand.Tables[0];
            gv1.AutoGenerateColumns = false;
            gv1.DataBind();
 
        }
    }//end of class
Thanks & Regards,
 
Abdul Aleem Mohammad
St Louis MO - USA

REST service using classic ASP

$
0
0
Hi ,
Can we write a pure JSON REST service using classic ASP ?. My client requirement is to write it in classic ASP not .net. Could you please help.
 
Regards
Subin

Sending free sms through ASP.Net

$
0
0
Respected Sir, I want to send an sms through ASP.Net Without any Gateways . So please Send me the Source code to send free Sms....
                                
                                 Thanking you
                                                               Yours faithfully
                                                               (SharathMadhav)

Asp.Net Notifiation Push

$
0
0
Hi All,
 
I develop an ASP.Net Web Application that handle the daily work requests such as vacations, overtime, Leave Work, etc....
This process as the following:
1. the employee request from his account a vacation request.
2. the manager see this request and can approve or reject it.
 
My need when the user insert his request I want to send an auto-alert (Notification) like messenger alert for the manager,
Is it possible by the asp.Net (web application).
 
How can I do that?
Thank You.

Managing XML Files

$
0
0
Hello,
 
The site I am working on gets its data from small XML files (a few KB) that are refreshed every minute by external tools.
 
Knowing that multiple users will view pages, I think the best way would be to put them as static XmlDocument objects.
 
private XmlDocument bodyStatuses = new XmlDocument (myfile));
 
My first question is: knowing that the file will be refreshed on a regular basis, when is the "new" object actually created (pointing to the new version of the file, with new handle, etc..) ?
Can I safely assume that ASP manages that for me ?
 
Second question, in the same vein. When I use the same XmlDocument in multiple instances of a user control placed on the same page, could I also put my XML file as static in the user control ? so that it is only opened once (1st user control), and read once per user control ?
 
I am OK in C#, but new to ASP, so I don't know how such things are handled internally, and I would not want to hinder performances with bad coding habits Smile | :)
 
Thanks in advance.

MVC AntiForgeryToken and Partial Views

$
0
0
If I have a form/view that will display 1 or more partial views based on user responses. Where do I need to place the AntiForgeryToken? In the parent view? In the partial views? Both?
 
Currently, I have it in the partial views, but we are occasionally getting an error:
 
Type:System.Web.Mvc.HttpAntiForgeryException
Message:A required anti-forgery token was not supplied or was invalid.
 
The error is reported in production only, we are unable to reproduce it on developer machines (typical).
 
My theory is that when multiple partial views are represented a mismatch of tokens occurs and the error is reported. My thinking is to move the token to the main/parent view.
 
Am I on the right track? Anybody had to deal with something similar?
 
Thanks in advance for the feedback.

How to test load of a web service ????????

$
0
0

Quote:
How to test load of a web service.
 
I have developed a web service that handles user login information,and after login it transfers huge data from one server to another server like daily 1 lakh records or more daily from one user.I want to test how much load it can take for transferring data from one server to another server.The application can have only 100 login users but data transfer is big. so i am worried about data transfer when all users login at same time and transfers data at the same time. Plz help me. I want

Viewing all 3938 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>