Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

uglyeyes

@uglyeyes
About
Posts
340
Topics
143
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Classic asp Soap response with xml and attachment
    U uglyeyes

    I had to save the stream to file, do some string manipulation and just resave the file with xml only. it worked!.

    Web Development help xml wcf sysadmin career

  • Classic asp Soap response with xml and attachment
    U uglyeyes

    anyone?

    Web Development help xml wcf sysadmin career

  • Classic asp Soap response with xml and attachment
    U uglyeyes

    Hi, The soap request is sent using set objReturn = Server.CreateObject("Msxml2.DOMDocument") set objHTTP = server.CreateObject("Msxml2.ServerXMLHTTP") objHTTP.setTimeouts lResolve, lConnect, lSend, lReceive objHTTP.open "POST", strURL, False on error resume next objHTTP.setRequestHeader "Content-Type", "text/xml; charset=UTF-8" objHTTP.setRequestHeader "Content-Disposition", "attachment;filename=""PDFTEST.pdf""" objHTTP.send strXML The response I get is per below in binary ------=_Part_97_1242713853.1455190897041 Content-Type: text/xml; charset=utf-8

    ****XML related document****
    ------=_Part_97_1242713853.1455190897041
    Content-Type: application/pdf
    ****PDF related document****

    I could output into text using below function Binary to String function Function BinaryToString(Binary) Dim I, S For I = 1 To LenB(Binary) S = S & Chr(AscB(MidB(Binary, I, 1))) Next BinaryToString = S End Function The request Attachment is read like below: '--- attachments ---' 'Create Datastream object to save the file set DataStream = CreateObject("ADODB.Stream") 'Open Datastream DataStream.Open 'Set type to binary DataStream.Type = 1 'Create bianry datastream of the file DataStream.Write objHTTP.ResponseBody 'strReturnfile DataStream.Position = 0 'Set the File System Object, so we can check to see if it already exists. set FSO = Createobject("Scripting.FileSystemObject") 'If the file already exists, delete it if FSO.FileExists(SaveAsFile) then Fso.DeleteFile SaveAsFile End If set FSO = Nothing 'Write the file to the location on the server DataStream.SaveToFile SaveAsFile 'Close Datastream DataStream.Close 'Delete Datastream object set DataStream = Nothing '--- attachments end---' Now my problem is I need to just read XML using loadXML() Can anyone please help as I have spent few days and really lost. Thanks

    Web Development help xml wcf sysadmin career

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    Hi, thanks for the detailed explaination. In my case, a company can have many customer and a customer can belong to many companies. only customers will have order. Sorry to call this "order". It should actually be called "Job". Would I require making any changes to what you have described above for my situation?

    C# com sales help

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    Ok. I did as per you mentioned but I get below error now

    using (var dbCtx = new CustomerManagerContext())
    {
    dbCtx.Customers.Add(customer1);
    dbCtx.SaveChanges();
    dbCtx.Customers.Add(customer2);
    dbCtx.SaveChanges();
    dbCtx.Companies.Add(company1);
    //call SaveChanges
    dbCtx.SaveChanges();

                 dbCtx.Orders.Add(order1);
                 dbCtx.SaveChanges();
                dbCtx.Orders.Add(order2);
                 dbCtx.SaveChanges();
                
            }
    

    Entities in 'CustomerManagerContext.Customers' participate in the 'Customer_Companies' relationship. 0 related 'Customer_Companies_Target' were found. 1 'Customer_Companies_Target' is expected. this is because I have below method

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {

            modelBuilder.Entity().
            HasMany(c => c.Companies).
            WithMany(p => p.Customers).
            Map(
            m =>
            {
                m.MapLeftKey("CustomerId");
                m.MapRightKey("CompanyId");
                m.ToTable("CustomerCompany");
            });
            modelBuilder.Entity().HasRequired(c => c.Customers).WithMany().WillCascadeOnDelete(false);
            modelBuilder.Entity().HasRequired(c => c.Companies).WithMany().WillCascadeOnDelete(false);
            base.OnModelCreating(modelBuilder);
        }
    

    sorry still learning entity framework.

    C# com sales help

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    could you please help me? If I first save company first it will be as below

    using (var dbCtx = new CustomerManagerContext())
    {

                dbCtx.Companies.Add(company1);
                //call SaveChanges
                dbCtx.SaveChanges();
            }
                company1.Customers.Add(customer1);
                company1.Customers.Add(customer2);
                customer1.Orders.Add(order1);
                customer2.Orders.Add(order2);
    

    how do I now save customer1, customer2 and order1 and order2 using the context?

    C# com sales help

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    I updated the code to be below: but still getting same error

    Company company1 = new Company();
    company1.CompanyId = 1;
    company1.Name = "abc";
    company1.Email = "abc@hotmail.com";
    company1.Address = "xyz street";
    company1.City = cityState[0];
    company1.State = sortedStates.Where(state => state.Abbreviation == cityState[1]).SingleOrDefault();
    company1.StateId = 1;
    company1.Zip = 2066;
    company1.Phone = "949494848";
    company1.Customers = new List();

            Customer customer1 = new Customer();
            customer1.CustomerId = 1;
            customer1.FirstName = "bikash";
            customer1.LastName = "shrestha";
            customer1.Email = "bikash@hotmail.com";
            customer1.Address = "482 pacific hwy";
            customer1.City = "Phoenix,AZ";
            customer1.State = sortedStates.Where(state => state.Abbreviation == cityState\[1\]).SingleOrDefault();
            customer1.StateId = 1;
            customer1.Zip = 85230;
            customer1.Gender = Gender.Female;
            customer1.Orders = new List();
    
            Customer customer2 = new Customer();
            customer2.CustomerId = 2;
            customer2.FirstName = "prakash";
            customer2.LastName = "shrestha";
            customer2.Email = "prakash@hotmail.com";
            customer2.Address = "482 pacific hwy";
            customer2.City = "Phoenix,AZ";
            customer2.State = sortedStates.Where(state => state.Abbreviation == cityState\[1\]).SingleOrDefault();
            customer2.StateId = 2;
            customer2.Zip = 85231;
            customer2.Gender = Gender.Male;
            customer2.Orders = new List();
    
            Order order1 = new Order();
            order1.Id = 1;
            order1.CustomerId = 1;
            order1.Product = "apple";
            order1.Date = DateTime.Today;
            order1.Price = 5;
            order1.Quantity = 1;
    
            Order order2 = new Order();
            order2.Id = 2;
            order2.CustomerId = 1;
            order1.Product = "apple";
            order2.Date = DateTime.Today;
            order2.Price = 5;
            order2.Quantity = 1;
    
    
            customer1.Orders.Add(order1);
            customer2.Orders.Add(order2);
            company1.Customers.Add(customer1);
            company1.Customers.Add(customer2);
            
    
            us
    
    C# com sales help

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    anyone please?

    C# com sales help

  • Unable to cast object of type 'System.Collections.Generic.List`1[CustomerManager.Model.Customer]' to type 'CustomerManager.Model.Customer'.
    U uglyeyes

    I am getting this Unable to cast object of type error for below code var cityState = SplitValue(citiesStates[0]); var customers = new List() { new Customer() { CustomerId = 1, FirstName = "bikash", LastName = "shrestha", Email = "bikash@hotmail.com", Address = "482 pacific hwy", City = "Phoenix,AZ", State = sortedStates.Where(state => state.Abbreviation == cityState[1]).SingleOrDefault(), Zip = 85230, Gender = Gender.Female }, new Customer() { CustomerId = 2, FirstName = "prakash", LastName = "shrestha", Email = "prakash@hotmail.com", Address = "482 pacific hwy", City = "Phoenix,AZ", State = sortedStates.Where(state => state.Abbreviation == cityState[1]).SingleOrDefault(), Zip = 85231, Gender = Gender.Male } }; customers.ForEach(p => context.Customers.Add(p)); var companies = new List() { new Company() { CompanyId = 1, Name = "abc", Email = "abc@hotmail.com", Address = "xyz street", City = cityState[0], State = sortedStates.Where(state => state.Abbreviation == cityState[1]).SingleOrDefault(), Zip = 2066, Customers = new List { customers.Single(u => u.CustomerId == 1), customers.Single(u => u.CustomerId == 2) } } }; companies.ForEach(p => context.Companies.Add(p)); <-- here is the error. context.SaveChanges(); My classes ---------- public class Company { public int CompanyId { get; set; } [StringLength(50)] public string Name { get; set; } [StringLength(200)] public string Address { get; set; } [StringLength(500)] public string Email { get; set; } [StringLength(1000)] public string Phone { get; set; } [StringLength(50)

    C# com sales help

  • avoid running function in page load event of user control inside a page with in master page
    U uglyeyes

    anyone??

    ASP.NET help database question

  • avoid running function in page load event of user control inside a page with in master page
    U uglyeyes

    but repeater control has drop down list, textbox and are editable and I need to get the value of them as well. how do I do that? here is a details of my issue ViewState is disabled through out the entire aspx page Page contains a multiview control which has views and views has user controls prev and next button clicking prev or next button saves current data (SET()) within user control and loads data(GET()) of next user control (if it has any) one of the user control in a view has editable repeater control. in page load of this control I am binding the repeater as Repeater.DataSource = List of object Repeater.Databind() The problem is, this page load is being called disregard the view being active or inactive. So I need to bind the repeater else where in the user control so in my GET() function in aspx (where I load the user control with repeater) I bind the repeater by declaring repeater object as property in ascx as Me.RepeaterAsProperty.DataSource = List of object Me.RepeaterAsProperty.DataBind() I removed databind codes from ascx. upto now it works all good. When I click next button when this user control is active, I need to save modified data with in this repeater. so in SET() function I run a loop to get Me.RepeaterAsProperty.Items which is empty. I dont know how to get this working.

    ASP.NET help database question

  • avoid running function in page load event of user control inside a page with in master page
    U uglyeyes

    Hi, hoping someone can give me hint to solve this. I have a multiview web control in a aspx page with in master page. each view with in multiview has ascx page. by default first index of the view is set to active. as the page needs to go though the standard page life cycle so it will run all page load events of ascx even though i sent the first view to be active view. in one of the ascx page with in the view has a repeater control and i am loading a data in page load event in that ascx and its being executed everytime even though this control is not with in active view. so in aspx active view index change i added a dataload function for this page so when this the control is in the activeview the data source get bind to the control. these all is working fine. my problem is how do i get the updated dataset from ascx to aspx so i could store it in session or something without adding any function in page load event of user control. please help

    ASP.NET help database question

  • storing bread crumb state after postback
    U uglyeyes

    Hi, after all the searches I managed to create a bread crumb using the link http://www.codeguru.com/vb/vb\_internet/aspnet/article.php/c6851 but the bread crumb information gets lost on postback. I dont know how to store the information in page level so I could maintain it. could someone please give me some direction as to how I can solve it.

    ASP.NET php asp-net com tutorial

  • refreshing second combo by first not working
    U uglyeyes

    Ok I had to clear the combo in pageload but how do I add "Please select" in this situation? -- Modified Wednesday, April 13, 2011 9:02 AM

    C# sysadmin help

  • refreshing second combo by first not working
    U uglyeyes

    Hi, when I select region combo, I can populate country combo but when I re-select region combo again, country combo append the listitem on top of the previous value. not sure why its happening. below is my code protected void Page_Load(object sender, EventArgs e) { if (!(IsPostBack)) fillcombos(); ddRegion.SelectedIndexChanged +=new EventHandler(ddRegion_SelectedIndexChanged); } protected void ddRegion_SelectedIndexChanged(object sender, EventArgs e) { DataSet ds = new DataSet(); if (ddRegion.SelectedIndex >-1) { ds = myBLL.GetRegionOverviewAndCountryByRegionId(Convert.ToInt32(ddRegion.SelectedValue)); DataRow dr = ds.Tables[0].Rows[0]; // get the first row returned if (dr.ItemArray.Count() > 0) { txtRegionOverview.Text = dr["RegionOverview"].ToString(); ddRegion.SelectedValue = dr["RegionId"].ToString(); } if (ds.Tables[1].Rows.Count > 0) { ddCountry.DataSource = ds.Tables[1].DefaultView; ddCountry.DataTextField = "CountryName"; ddCountry.DataValueField = "CountryCode"; } else { ddCountry.DataSource = null; } ddCountry.DataBind(); } } public void fillcombos() { List<Region> regionList = new List<Region>(); regionList = myBLL.GetRegionList(); ddRegion.DataSource = regionList; ddRegion.DataTextField = "RegionName"; ddRegion.DataValueField = "RegionId"; ddRegion.DataBind(); } --- asp:DropDownList ID="ddCountry" AutoPostBack="true" runat="server" ></asp:DropDownList> in addition, I wanna it to work when i add "select a region", "select a country" at the top with ddregion.items.insert(0,"select.." please help

    C# sysadmin help

  • iterating through the datalist rows
    U uglyeyes

    Hi, I have a datalist paging enabled in my datalist that shows 10 records per page. but I would like to display a image after every 3rd record. not sure how do i do that. could someone please help? I basically like to inject a hard coded image in the datalist.

    ASP.NET question help

  • datalist display adsense after particular row
    U uglyeyes

    could you please give me some coding tips as in how to not lose 4th row?

    ASP.NET database help tutorial

  • datalist display adsense after particular row
    U uglyeyes

    Hi my datalist web control is bound to a database. i want to display google adsense after 3rd row. i am not sure how i can do that. could someone please help or guide me to right direction

    ASP.NET database help tutorial

  • efficiently paging very large record set (~500000) records
    U uglyeyes

    I am sure there must be an alternative solutions other than multi-threading. I saw this article http://www.netomatix.com/Development/DataListPaging.aspx in this article it users query string but how can i use it without having to use querystring could someone please help? I now have created two stored proc one returns the total count of the result which is about 35000 and the one to display for a page currently being views i.e. adverts = myBLL.GetAdverts(country, city, adtype,NowViewing,pds.PageSize); -SQL SELECT * FROM ( select ROW_NUMBER() OVER(ORDER BY adid) as RowNum, a.* from advert where isActive=1 and c.countryname like '%'+@CountryName+'%' and a.adcity like '%'+@AdCity+'%' and a.AdSubCatType like '%'+@AdSubCatType+'%' ) as DerivedTableName WHERE RowNum BETWEEN @CurrentPageIndex AND (@CurrentPageIndex + @PageSize) - 1 order by adDate desc

    ASP.NET question csharp asp-net com help

  • efficiently paging very large record set (~500000) records
    U uglyeyes

    can someone please help me. I need a fastest way to display datalist with hugh record set in website.

    ASP.NET question csharp asp-net com help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups