Subscribe: Custom Server Controls
http://forums.asp.net/rss.aspx?ForumID=19
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
columns columns  columns  field field  field sum  field  new  set } public  set  string  sum field  sum  } public string  } public 
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: Custom Server Controls

All Forums



All Forums



Last Build Date: Wed, 20 Sep 2017 02:39:04 -0700

 



C# Long running threads

2017-09-20T08:09:15.627-07:00

Hello all!

How can I tell Windows that my thread is long running? 

Thank you for assistance.




Web API

2017-09-19T19:04:40.16-07:00

I want to use a Web API to populate a select element using the entity framework as my datasource and mvc as my framework. Thanks !
Also I was wondering why would it be a best practice to use a Web API? I'm using an example that currently returns a Json result and I was wondering why?




smtp setup for email from within .aspx instead of config file

2017-09-13T06:36:04.37-07:00

is there some way to invoke smtp mail from with the program instead of using the web.config file?

this code inside my .aspx does not work

Dim smtpServer As New SmtpClient
If emailValidateReq Then
smtpServer.Credentials = New Net.NetworkCredential(emUser, emPswd)
End If
smtpServer.Host = "smtp.gmail.com"
smtpServer.Port = "587"
smtpServer.EnableSsl = True

the above returns

System.InvalidOperationException: The SMTP host was not specified.
at System.Net.Mail.SmtpClient.CheckHostAndPort()
at System.Net.Mail.SmtpClient.Send(MailMessage message)

for the above I have this name space in my web.config

I tried to use the web.config, but it times out on the send and it is not even allowing me to specify "enableSsl" 

which appears to be needed for smtp with gmail




password="aValidPassword"
userName="aValidGmailAddress"
port="587"
/>




can anyone please explain this idea to me ?

2017-09-20T03:19:16.49-07:00

Hello, i am developing a database software in vs2015(winform)..Now..my idea is, i want to make such a app that a user can access via web..I mean i am also making an asp.net app which is pretty much same of the winform app....which will also use the same database as the winform app.....A user from anywhere using any web browser can access the asp.net application and can read/write data to the database......can anyone please explain this idea to me ? or what this i need to do in order to do so ?




Hierarchical Data Management with EF

2017-09-19T14:09:28.27-07:00

just read article from this link https://www.mikesdotnetting.com/article/255/entity-framework-recipe-hierarchical-data-management

(image)

why menuitemid column is required in table. if i develop the same table then it would look like

id, menutext, linkUrl, Order, ParentID

so tell me what kind of info menuitemid will contains. thanks




OleDbDataAdapter UPDATE ERROR

2017-08-11T09:33:05.197-07:00

Hi, I am trying to update table values using OLEDATA ADAPTER. But, i am getting following Error  it will throw the error in adp1.Update(newdt) Error : Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information. My datatable structrue below : Subjects Marks Department Name Maths 100 IT ABC Science 80   ABC GK 95   ABC History 78   ABC Complete source code :                                                                                                                                           using (OleDbConnection cn = new OleDbConnection(connectionstring))                 {                     cn.Open();                     DataTable Schema = cn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });                     for (int i = 0; i <= Schema.Rows.Count - 1; i++)                     {                         try                         {                                                         if ((Schema.Rows[i]["TABLE_NAME"]).ToString() == tableName)                             {                                 using (OleDbDataAdapter adp1 = new OleDbDataAdapter("SELECT * FROM [" + (Schema.Rows[i]["TABLE_NAME"]).ToString() + "]", cn))                                 {                                     OleDbCommandBuilder commandBuilder = new OleDbCommandBuilder(adp1);                                     adp1.Update(newdt);                                     commandBuilder.QuotePrefix = "[";                                     commandBuilder.QuoteSuffix = "]";                                     dt = newdt;                                     return dt;                                 }                             }                                                     }                         catch (Exce[...]



weird input textbox

2017-09-18T04:24:24.8-07:00

i have a textbox with weird behavior:

1) i can't enter ( -- shift 9--

i have to resolve to use copy-and-paste just to enter that (

2) many time when i entering a number (year), there is overlay of its original value remained in the box, overlapped with what i entered. and this affect the logic/result.

for whatever steps i not sure i taken, at times i can properly and cleanly enter the intended number then it worked properly

i'm guessing some js bind to the class/css, but im not getting any clue using chrome browser developer tool when inspecting it

how to fix/troubleshoot this?




asp:TextBox bind condition if null

2017-09-19T08:44:13.423-07:00

I am a beginner using Visual Studios 2012 in VB and I have simple formview to insert a new serial number.

How do I add a condition to prompt a message to the user that a null serial number or a duplicate serial number is not allowed? 

I tried "If(Bind("Serial").ToString() Is DBNull.Value, "Null SN not allowed", Bind("Serial"))" but that did not work as Bind gets a not declared error.

Here is my code: (also I suspect I only need the "Insert Item Template" and the other templates are not needed)

Note: the VB works fine if I enter a valid serial number


                
                    Serial:
                    
                    
 
enter a s/n Serial:
 
Serial:
 

Thanks




Filtering

2017-09-15T10:26:11.017-07:00

I have a two related tables.

public partial class Companies

{
public Companies()
{
ContactsNavigation = new HashSet();
}

public int Id { get; set; }
public string Inn { get; set; }
public string MainName { get; set; }
public string Name { get; set; }
public string Place { get; set; }
public string Contacts { get; set; }
public string Notes { get; set; }
public int Rate { get; set; }
public string Comments { get; set; }
public string Responsible { get; set; }
public bool? Favorites { get; set; }

public ICollection ContactsNavigation { get; set; }
}

and 

public partial class Contacts
{

public int Id { get; set; }

public string NameFio { get; set; }
public string PhoneNumber { get; set; }
public string Mail { get; set; }
public string Username { get; set; }
public int? IdofMedInst { get; set; }
public int? IdofCompanies { get; set; }
public string Position { get; set; }

public Companies IdofCompaniesNavigation { get; set; }
}

Than I create "CompaniesController" with filtering

IQueryable Company = _context.Companies.Include(c => c.ContactsNavigation);

if (!String.IsNullOrEmpty(CompaniesInput))
{
Company = Company.AsQueryable().Where(p => p.Inn.Contains(CompaniesInput) || 
p.Name.Contains(CompaniesInput) || p.Contacts.Contains(CompaniesInput));
}

Is there any way to find all Companies where Contacts (from table Contacts) contain  data from "CompaniesInput" ?




migrate to vs community 2017

2017-09-18T07:53:55.307-07:00

installed vs community 2017, trying to migrate a vs2008 website, create the project in 2017, bring in vs 2008 files by add existing items, rebuild ok, but when try to debug get the following message about can't run some dll. there is a whole bunch of new stuff in a .../bin/roslyn folder including the new dll which is completely new from anything in 2008, this is not anything of my doing, some bug in vs2017?

I would post the pic of the error message, a jpg I saved but there's no way to just attach/upload an image in this forum? without the image being somewhere on the web? with its own url? 




Compile C# library as a static library (.lib)

2017-09-20T09:07:46.423-07:00

Hi,

I have been asked to compile a C# (Framework 4.6) library into a static library (.lib) instead of dynamic library (.dll) for a user that wants to use my lib into a C++ project.

The user managed to make it work as a Dynamic Library (.dll), but requires it to be a static library (.lib) for obscur reasons.

Is it possible to do this with Visual Studio (VS 2015 or VS Community 2017) and how ?

Thanks




Multiple model in Single View using System.Dynamic in MVC is good

2017-09-20T08:36:06.44-07:00

when we work with multiple view then we go for viewmodel but we can use dynamic to add property at runtime and populate those property from db.

here is a small example which i got from https://www.codeproject.com/Articles/1206946/Multiple-model-in-Single-View-using-System-Dynamic

public ActionResult MultiView()

{

//Multiview code goes here

SPCFEntities db = new SPCFEntities();

dynamic dymodel = new ExpandoObject();

dymodel.modContact = db.Contacts.ToList();

dymodel.modVacancy = db.Vacancies.ToList();


return View(dymodel);

}
@model dynamic

@{

ViewBag.Title = "MultiView";

}

Multiple model in single view


Contact Data

@{ WebGrid obj = new WebGrid(Model.modContact, rowsPerPage: 10, canSort: true, canPage: true); } @obj.GetHtml()

Vacancy Data

@{ WebGrid obj2 = new WebGrid(Model.modVacancy, rowsPerPage: 10, canSort: true, canPage: true); } @obj2.GetHtml()

i just like to know if we work with dynamic without viewmodel then it will be good approach and performance will be good ? please guide me. thanks




ASP.MVC 5 - JQuery - Fill up the select option/dropdownlist box by clicking the button without page post back

2017-09-19T00:59:52.233-07:00

Good Day Everyone

I'm creating a page that has a button that fills up the select option or dropdownlist, I want to use JQuery/Json/Ajax so the page won't postback when i click the button with the following details "Superman", "Batman" and "Wonderwoman". Does anyone knows how to do this? please take note that I'm a beginner on this so please bear with me.

Thanks and Regards.




Hindi unicode not properly rendering in PDF made by ItextSharp

2017-09-19T07:34:07.533-07:00

Dear Friends,

I was creating a PDF file with English and Hindi language. 

I am using iTextSharp library for writing PDF, as all English letters form properly but I am facing problem in writing Hindi in that.

For example, It write अक्टूबर as अकटूबर्  and  मार्च as मारच्. I Have tried a number of things but still no luck.

I am using following code

 string fontpath = Environment.GetEnvironmentVariable("SystemRoot") + "\\fonts\\MANGAL.TTF";// ARIALUNI.TTF";//
 BaseFont bf = BaseFont.CreateFont(fontpath, BaseFont.IDENTITY_H, true);

 int monthNumber = Convert.ToDateTime(str[0] + " 01, 1900").Month;
 monthNameInHindi enumDisplayStatus = (monthNameInHindi)monthNumber;
 string stringValue = enumDisplayStatus.ToString();

 cb.SetFontAndSize(bf, 11);
 cb.ShowTextAligned(PdfContentByte.ALIGN_LEFT, Server.HtmlDecode(changeHindiGlyph(stringValue)), 555f, 515f, 180);

Please advise some help.




Unable to find version '2.0.0' of package 'Microsoft.AspNetCore.Identity'

2017-09-19T18:40:44.723-07:00

I'm running VS2017 v15.3 on Windows 7 x64.  I seem to have a problem installing nuget core 2.0 pkgs.  I've tried to install various asp.net core 2.0 pkgs in different applications and I keep getting the following err:


Install-Package : Unable to find version '2.0.0' of package 'Microsoft.AspNetCore.Identity'.
At line:1 char:1
+ Install-Package Microsoft.AspNetCore.Identity -Version 2.0.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.Inst
   allPackageCommand


You can substitute Microsoft.AspNetCcore.Identity w virtually any aspnet core pkg and get the same error.

If I browse and search for the pkg only v1.1.2 comes up.  The about box says I'm running VS2017 v15.3.3 and I recently ran a repair using the VS installation.

The project I'm currently working on is an AspNetCore 2.0 library, but I seem to get the same error regardless of the project.




need template for Employee Promotion

2017-09-19T14:11:02.07-07:00

Hi,i need to develop employee promotion in MVC4. i didn't get any template from online.please any one post the template or tell what are the fileds it contains normally.

Already i have a employee information details.based on that i have to work.




Merging rows together based on similare values

2017-09-19T14:50:53.85-07:00

Hello world,

Using the following queries I realized that the data I need is spread among different events (because of the way the events are were implementated in the software).

SELECT
sessionID
,machineID
,productsManufactured
FROM events;
sessionID	machineID	productsManufactured
    1		                         10
    1	          AZ342	
    2	          CDFRT	
    2		                         43
    3	          GHTTR3	
    3		                         76
    4	          CDFRT	
    4		                         23

What I would like to do is to combine the machineID info and the productsManuctured info together on the same row. Getting something like this :

machineID	SUM_productsManufactured
  AZ342	                   10
  CDFRT	                   66
  GHTTR3	           76

Note that I don't really need the sessionID data but it seems to be the only way to link the machineID and the productsManuctured info together.

I've tried many different ways and couldn't make it work. Any idea on how to do it?

Thanks a lot for your help.




Prompt line can not be fired

2017-09-20T07:07:28.287-07:00

Dear,
Do you know why 2nd prompt below, cannot be shown?

        protected void LoginButton_Click(object sender, EventArgs e)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "javascript:alert('22');", true);
            TextBox tb_userid = (TextBox)Page.FindControl("tb_userid");
            TextBox tb_password = (TextBox)Page.FindControl("tb_password");
            HtmlGenericControl Userid = (HtmlGenericControl)Page.FindControl("userid");
            HtmlGenericControl loginpassword = (HtmlGenericControl)Page.FindControl("loginpassword");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "通知", "javascript:alert('22"+tb_userid.Text+"');", true);
			...




Foreground thread

2017-09-20T08:30:41.367-07:00

Hello all!

Is the webapplication stopped running when all sessions terminated? Is my webapp permanent runs while it has foreground threads? Is it permanent runs when it has infinite loop in foreground thread?

Thank you for assistance. 




show all of the data in the same web form simultaneously

2017-09-20T01:38:33.277-07:00

Hi,   I want to join two tables. Select A.Key,A.Col1,A.Col2,B.field1,B.field2,B.field3,B.field4,B.field5  from Table1 A Left Outer Join Table2 B On B.Key=A.Key.And I want to display the data as follows. Id: A.Key IP: A.Col1 Name: A.Col2     Columns1 Columns2 Columns3 Columns4 Columns5 B.field1 B.field2 B.field3 B.field4 B.field5 B.field1 B.field2 B.field3 B.field4 B.field5 Total Sum( B.field2) Sum( B.field3) Sum( B.field4) Sum( B.field5)     My question is if the value of A.Key is ‘0001’,’0002’, ‘0003’, etc.I want to show all of the data in the same web form simultaneously. Thanks. Id: 0001 IP: A.Col1 Name: A.Col2     Columns1 Columns2 Columns3 Columns4 Columns5 B.field1 B.field2 B.field3 B.field4 B.field5 B.field1 B.field2 B.field3 B.field4 B.field5   Sum( B.field2) Sum( B.field3) Sum( B.field4) Sum( B.field5) Id: 0002 IP: A.Col1 Name: A.Col2     Columns1 Columns2 Columns3 Columns4 Columns5 B.field1 B.field2 B.field3 B.field4 B.field5 B.field1 B.field2 B.field3 B.field4 B.field5   Sum( B.field2) Sum( B.field3) Sum( B.field4) Sum( B.field5)   Id: 0003 IP: A.Col1 Name: A.Col2     Columns1 Columns2 Columns3 Columns4 Columns5 B.field1 B.field2 B.field3 B.field4 B.field5 B.field1 B.field2 B.field3 B.field4 B.field5   Sum( B.field2) Sum( B.field3) Sum( B.field4) Sum( B.field5) [...]