Subscribe: Web Forms
Added By: Feedage Forager Feedage Grade B rated
Language: English
book  client  code  count  data  emp  int  list  mvc  new  partial  public  return  string  system  void  web  zip 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Web Forms

All Forums

All Forums

Last Build Date: Sun, 17 Dec 2017 04:44:31 -0800


Download large files of 2 GB


I am using below script and it fails to download large files. below is my code ..any idea

DataRow dr = ds.Tables[0].Rows[0];

        if (checkSelectedFiles() == true)  {

            using (Ionic.Zip.ZipFile zip = new Ionic.Zip.ZipFile())


                var pkgName = dr["Name"].ToString().Trim() + " v" + dr["PackageVersion"];

                zip.AlternateEncodingUsage = Ionic.Zip.ZipOption.AsNecessary;


                foreach (RepeaterItem item in frmDownloadFiles.Items)


                    if ((item.FindControl("frmFileChecked") as CheckBox).Checked)


                        string filePath = (item.FindControl("frmFilePath") as HiddenField).Value;

                        string fileName = (item.FindControl("frmFileName") as HiddenField).Value;

                        zip.AddFile(filePath, pkgName);




                Response.BufferOutput = false;

                Response.ContentType = "application/zip";

                Response.AddHeader("content-disposition", "attachment; filename=" + pkgName + ".zip");

            ///    Response.TransmitFile(pkgName + ".zip");




GridView Row Command Event is not firing


Dear all, My GridView Row Command Event is not firing when i deploy this application on server, the same code in my local machine works fine,  code is as shown below <%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"     CodeFile="Urban_Name_Duplicate_WorkOrder.aspx.cs" Inherits="Urban_Name_Duplicate_WorkOrder" %>        

Receiving live data on server


Live weather data needs to be sent to my server 2012, so far i have created a .Net web page which can read query string and save it to some file on server. Its been hosted on IIS 8.0. Eaxmple(

I was wondering if this is a right way of receiving data on server? the other idea i had in mind was soap web services but not sure if it can add any benefits to what i have already done.

protected void Page_Load(object sender, System.EventArgs e)
  if (Request.QueryString.Count > 0)
    string query = Request.QueryString("str");
    using (StreamWriter _testData = new StreamWriter(Server.MapPath("~/data.txt"), true))

Could not create type Webservice error


Hi Guys,

I've created a very simple webservice and its runs fine in my local development machine, but when deploying in IIS and running it online I get "Could not create type WebService"

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="WebService" %>

I also tried adding the project name to class name but still get the same error

<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="cvDesktop.WebService" %>

any help please?




Can anyone please tell me   what is the main Advantages  if we are using Connection String Builder




 IN a report i want if user wants to display report for month of Oct then all days should be display even if there is no Sale on that day and against that day Sale of that day.

01.10.2017    10000.00

02.10.2017    12000.00 & so on till 31st.


why can't this code run right ?


OrderInfoModel.cs using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections.Generic; using System.Linq; using System.Web; namespace WebGridApplication1.Models {     public class OrderInfoModel     {         string SqlStr { get; set; }         public OrderInfoModel(string sqlstr)         {             SqlStr = sqlstr;         }         public DataTable GetOrderInfoData(string sqlstr)         {             DataSet ds = null;             string connStr = ConfigurationManager.ConnectionStrings["DJERPConnStr"].ToString();             using (SqlConnection con = new SqlConnection(connStr))             {                 con.Open();                 SqlDataAdapter da = new SqlDataAdapter(this.SqlStr, con);                 ds = new DataSet();                 da.Fill(ds);             }             return ds.Tables[0];         }     } } OrderInfoController.cs using System; using System.Data; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using WebGridApplication1.Models; namespace WebGridApplication1.Controllers {     public class OrderInfoController : Controller     {         // GET: OrderInfo         public ActionResult Index()         {             string sqlstr = "select customerName,materialCodeCustomer from ut_OrderDeliveryDetail";             OrderInfoModel myOrder = new OrderInfoModel(sqlstr);                         DataTable dt=myOrder.GetOrderInfoData(sqlstr);             ViewBag.OrderInfo = dt.AsEnumerable();             return View();         }     } } Index.cshtml @{     Layout = "~/Views/Shared/_Layout.cshtml"; } @{     var grid = new WebGrid(ViewBag.OrderInfo, canSort: false);     @grid.GetHtml(     tableStyle: "table",     headerStyle: "gridhead",     mode: WebGridPagerModes.All,     firstText: "首页",     lastText: "尾页",     previousText: "上一页",     nextText: "下一页",     columns:grid.Columns(         grid.Column("customerName","cName")      )      ) } The wrong:System.InvalidOperationException:“列“customerName”不存在。” [...]

Consuming Web API with parameter


It is not working , when i call an web api with parameter. What should i do?

Web API :

        public object GetCategoryById(string idd)
            int id = Convert.ToInt32(idd);
                var objCategory = objBLL.GetCategoryById(id);

                if (objCategory != null)
                    return Json(new { ObjCategory = objCategory });
                    return Json(new { ObjCategory = objCategory });
                return Json(new { ObjCategory = "null" }); ;

Consuming Web API :

        public List GetCategoryById(int id)
            var stringID = new StringContent(id.ToString());

            //string Baseurl = "http://localhost:51269/";
            GlobalParameter gp = new GlobalParameter();
            string Baseurl = gp.BaseAPIUrl();

            List CategoryInfo = new List();

            using (var client = new HttpClient())
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = client.PostAsync("GetCategoryById", stringID).Result;
                if (Res.IsSuccessStatusCode)
                    var CategoryResponse = Res.Content.ReadAsStringAsync().Result;
                    JObject categoryJOBject = JObject.Parse(CategoryResponse);
                    IList results = categoryJOBject["ObjCategory"].Children().ToList();
                    foreach (JToken result in results)
                        Category searchResult = result.ToObject();


                return CategoryInfo;


Something wrong with parameter:

HttpResponseMessage Res = client.PostAsync("GetCategoryById", stringID).Result;

How to get cascade dropdown selection in MVC5 with angularjs


Dear All,

I have 3 dropdown depending on each other. Like second dropdown enable and fill with option when we select any option from first dropdown and so on.

Here is my entity framework query.


Here is my Angularjs Code:


Html View Code:


District dropdown popluated correctly, and tehsile dropdown also filled when district dropdown selected. but mouza dropdown not filled after tehsile dropdown selected.

Approaches in Entity framework (selection)


there are three 3 approaches in entity framework

i need to know

What is the better option for entity framework: Code-First or Database first or model first , how can i decide when i need to develop project,??

visual studio 2013 intellisense MVC


intellisense  mvis not working in mvc project ,but working in

i followed below

  1. you could check the setting under TOOLS->Options->Text Editor->the specific language(C#) ->IntelliSense.
  2. you can try reset the VS setting TOOLS->Import and Export Settings Wizard->Reset all settings.

but found below errror while working with 2nd option

Your settings were reset, but there were some errors.

Error 1:  Task List Display Settings: The tasklist format has changed.

Sum column with Linq to sql


I have a table Subscriber with columns
(Int)ID, (int)Fee, (unt)Bid
I want to sum column Fee in my table where Bid == x
How to do this with Linq to Sql c#?
Thanks in advance

Count subscribers per category



I have a table tblCategory(CatId, Category) and a table tblSubscribers(ScriberId,CatId,etc..)
I want to count subscribers per category, count even the categories that has 0 subscribers. I am using Linq to sql.
I have writen a method to do this job, my question is: if this is a good way to call the counter so many times. And if there is a better way to do this.

here is my code.

protected void Page_Load(object sender, EventArgs e)
    List scribersList = SubScribersByCategory.getGroupedList();
    if (scribersList.Count > 0)
public Category category { get; set; }
public int subscribers { get; set; }
private static string connStr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
public static List getGroupedList()
using (var db = new myDataContext(connStr))
List catList = Category.getCategoryListForOtherObject(db); List counterList = new List(); foreach (var x in catList) { SubScribersByCategory c = new SubScribersByCategory(); c.category = new Category() { category = x.category, catId = x.catId }; c.subscribers = Subscriber.countScribersByCatIdForOtherObjects(db, c.category.catId); counterList.Add(c); } return counterList; } }
internal static List getCategoryListForOtherObject(myDataContext db) {
var list = from c in db.tblCategories select new Category() { category = c.Category, catId = c.CatId }; return list.ToList(); } internal static int countScribersByCatIdForOtherObjects(myDataContext db, int catId) { var count = db.tblSubScribers.Count(x => x.CatId == catId); return count; }

Thanks in advance

How to query multiple Data or fields from repository pattern


    This is books model
    public class Book
        public int Id { get; set; }
        public string Title { get; set; }
        public string Authers { get; set; }
        [Display(Name = "Publish Year")]
        public string publishYear { get; set; }
        [Display(Name = "Price")]
        public decimal BasePrice { get; set; }
    Repository interface
    public interface IBookRepository : IDisposable
            IEnumerable GetBooks();
            Book GetBookByID(int bookId);
            void InsertBook(Book book);
            void DeleteBook(int bookID);
            void UpdateBook(Book book);
            void Save();

Book repository
public class BookRepository : IBookRepository
        private BookContext _context;
        public BookRepository(BookContext bookContext)
            this._context = bookContext;
        public IEnumerable GetBooks()
            return _context.Books.ToList();
        public Book GetBookByID(int id)
            return _context.Books.Find(id);
        public void InsertBook(Book book)
        public void DeleteBook(int bookID)
            Book book = _context.Books.Find(bookID);
        public void UpdateBook(Book book)
            _context.Entry(book).State = EntityState.Modified;
        public void Save()
        private bool disposed = false;
        protected virtual void Dispose(bool disposing)
            if (!this.disposed)
                if (disposing)
            this.disposed = true;
        public void Dispose()

code taken from

one simple question :- Now tell me how to fetch those books whose title is "blah" and Author is "test"

please show me with a sample code.

Mvc5 and vs2013 bootstrap theme


Can any share me what is best possible way to integrate any bootstrap theme with vs 2013 and mvc 5

Remove before and after Characters from String using Mid and Instr into VB.Net



i was able to retrieve the first value with the help from this forum. Now i would like to retrieve middle position characters only, in below string how can i retrieve Date Only (11-DEC-2017)?

002071:11-DEC-2017:1068 Gerard Avenue

To retrieve the first values i was using below code:

txtInsp_dt.Text = Mid(Ddl_newproj.SelectedItem.Text, 1, InStr(1, Ddl_newproj.SelectedItem.Text, searchchar, 1) - 1)

Appreciated for your help!

Using partial views to simplify a single view with many data sources



I am writing my fisrt ASP.NET MVC project and in my home page I have several sections to display and each section has its own elements of type List. The home page is composed of about 15 different sections of data and this implies that there are also 15 List. I guess that it is not a good idea to manipulate 15 List in a single view and I have thought that maybe using partial views is a good idea. This way, I would write 15 partial views that will be referenced from the main view. My main goal is organizing view code. As I say at the beginning of this post, I am an MVC newbie and for this reason I want to ask if using partial views is a good approach.

I will very much appreciate your comment.

Jorge Maldonado

Remove Characters from String using Mid and Instr into VB.Net



i am trying to extract part of string from drop-down. like  in drop-down i have 02-MAY-2017:Plaza Borinquen. All i am looking to get only Date that means (02-MAY-2017) and remove all the string after :

Below one returing last part of the string but i want to return first part:

Mid(Ddl_proj.SelectedItem.Text, InStr(1, Ddl_proj.SelectedItem.Text, searchchar, 1) + 1)

Thanks in advance

Performant Dynamic UI When Migrating From MVC4


Hi there, I have done some searching but have struggled to find a definitive answer to the best way of developing an MVC web app with a dynamic UI in the most performant manner in ASP.NET Core.

We have an existing web app written using MVC4 that uses partial views to render a dynamic UI in Razor CSHTML but I have found that the performance leaves a lot to be desired. For example, we load an object that contains some data and a number of dynamically defined columns and then loop through each data row in a razor view and then loop through each column - for every cell we then dynamically call a partial view that renders an appropriate editor/renderer for that cell depending on the data type - date, string, number etc. Even on a read only grid when I hardcode this partial view to a simple control that literally just renders a @value type thing the render time for 6-7 columns over 100 rows can be as much as 500ms consistently, even when deployed to a decent server. This seems like a large amount of time and seems to be down to referencing the partial view (via @Html.Partial("~/Views/Controls/StaticTextControl.cshtml", value) for each cell. If I remove the @Html.Partial and replace that with an inline @value then the render time for the grid is hugely faster. The large amount of controls we use inside the cells, along with the fact that they are also shared with other display components means inlining all that logic would be impractical.

I was thinking of attempting to migrate the solution to ASP.NET Core 2.0 and was wondering, am I going to run into the same issues there and if so, is there a recommended way of dealing with a more dynamic UI scenario? Would migrating the partial views for each of the cell renderers to ViewComponent help at all with render performance? This is probably the wrong forum but are there any patterns for existing MVC4/5 for dynamic UI that might also help?

Any advice would be greatly appreciated!

Thanks very much,


crystal is wrong result for one of the fields.


I've written SQL query in command line, where I'm counting the amount ($) for employees and spouses. I ran the result on sql plus and got $270 for employees and $210 for spouses. However, when I ran the query in crystal, I got $280 for employees and $210 for spouses. I'm doing all the work in my query. In crystal, I'm just displaying the fields. Please advise me as to what am I doing wrong here. Thanks in advance! Below is my query. With tb_main as ( SELECT CLIENT, AMOUNT, ACTIVITY_TYPE, PERSON_ID, EMP_SPOUSE_ID, company FROM MAIN ), tb_emp as (SELECT e.EMP_SPOUSE_ID, COUNT(e.CLIENT) OVER (PARTITION BY emp_cl,  SUM(e.AMOUNT) OVER (PARTITION BY emp_inc,  COUNT(e.CLIENT) OVER (PARTITION BY e.CLIENT) emp_group, SUM(e.AMOUNT) OVER (PARTITION BY e.CLIENT) emp_inc_group, COUNT(e.ACTIVITY_TYPE) OVER (PARTITION BY e.CLIENT) emp_act_type_group FROM tb_main e WHERE person_id = 11 ), tb_spouse as (SELECT s.EMP_SPOUSE_ID, COUNT(s.CLIENT) OVER (PARTITION BY sp_cl,  SUM(s.AMOUNT) OVER (PARTITION BY sp_inc,  COUNT(s.CLIENT) OVER (PARTITION BY s.CLIENT) sp_group, SUM(s.AMOUNT) OVER (PARTITION BY s.CLIENT) sp_inc_group, COUNT(s.ACTIVITY_TYPE) OVER (PARTITION BY s.CLIENT) sp_act_type_group FROM tb_main s WHERE person_id = 99 ) SELECT e.emp_cl, e.emp_inc, e.emp_group, e.emp_inc_group, e.emp_act_type_group,        s.sp_cl, s.sp_inc, s.sp_group, s.sp_inc_group, s.sp_act_type_group FROM tb_emp e LEFT OUTER JOIN tb_spouse s ON (e.emp_spouse_id= s.emp_spouse_id); [...]