vendredi 14 août 2015

How dynamicly add new partial form and how get data from them in ASP MVC?

I have project on ASP MVC 5. I have a model "Article". This model have HashSet and ICollection of Author. Author - second model:

 public partial class Article
{
    public Article()
    {
        Authors = new HashSet<Author>();
    }

    [DisplayName("Авторы")]
    public virtual ICollection<Author> Authors { get; set; }

I need to add page of creating Article, on which you can increase the number of authors(using AJAX), and each author to register the fields. I decided to use partial view of Author's model, without "Create" button(Create button used only view of creating Article). I need in unlimited adding new partial views, and after fill them - get all data from them. How make it? I newbie in MVC, and can't imagine how it will works.

http://ift.tt/1UFGYKD - an illustration of how it should look



via Chebli Mohamed

Settings in web.config for initialize database

I have Error :HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.

Detailed Error Information:
Module     IIS Web Core
Notification       Unknown
Handler    Not yet determined
Error Code     0x80070032
Config Error       The configuration section 'entityFramework' cannot be read because it is missing a section declaration
Config File    \\?\C:\Project\web.config

I use Entity Fremework Code First. And i'm initialize data for my table:

 namespace Project.NewFolder1.Initializer
{
    public class StackOverFlowInitializer : DropCreateDatabaseAlways<Test123Db>
    {
        protected override void Seed(Test123Db context)
        {
            var category = new List<Category>
            {
                new Category() {NameCategory = "C#"},
                new Category() {NameCategory = "ASP.NET"},
                new Category() {NameCategory = "ASP.NET MVC"},
                new Category() {NameCategory = "HTML"},
            };
            category.ForEach(s => context.Category.Add(s));
            context.SaveChanges();
        }
    }
}

In web.config i set:

 <connectionStrings>  
    <add name="Test123Db" connectionString="data source=.\SQLEXPRESS;initial catalog=StacjOverFlow;integrated security=True;application name=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>

<entityFramework>
   <contexts>
    <context type="Project.NewFolder1.Test123Db, Project">
      <databaseInitializer type="Project.NewFolder1.Initializer.StackOverFlowInitializer, Project" />
    </context>
</contexts>

</entityFramework>

What may be the problem?



via Chebli Mohamed

Import Certificate installed in browser to sign a document digitally and encrypting the excel file

I had an project in which the documents were digitally signed using .pfx files but now with the change in requirement, the organisation uses E-Tokens( usb devices), which when plugged in the computer, installs certificates into the browsers, now i need to digitally sign the pdf file and encrypt the excel file as, the digital signature is of class 3, signing and encryption both, signing for pdf file and encryption for excel file.

Can any one help me with a way on how to import the certificate installed in browser and den use the keys to sign and encrypt the excel file.



via Chebli Mohamed

How can I change the style of a line to dotted in a graph when exceeding a limit by using d3.js

I have created multi line graph in d3.js and I wanted to make the path of line to dotted when it exceeds a particular limit



via Chebli Mohamed

What are these ASP.NET Identity, Memberships? When to use them?

I have a website developed by using ASP.NET and DB is MYSQL. In there user authentication is done against registered users inside a table.

So What is this ASP.NET identity? Membership? things. When to use them? Are they secured approaches? Are they differ from what I am currently doing?

Thank you very much.



via Chebli Mohamed

retrieving multiple data from one column using vb.net

I m new to asp.net is there any way that i could display different data in one row where the data is pulled from same column of another table? where the column is name hello and contains 3 types of data let`s say my code is like this:

    cmd1.CommandText = " SELECT hello FROM link where mode=@model and procedure =@procedure "
    cmd1.CommandType = System.Data.CommandType.Text
    Dim da1 As New SqlDataAdapter()
    da1.SelectCommand = cmd1
    Dim dt1 As New DataTable()
    da1.Fill(dt1)
    Dim myDataReader1 As SqlDataReader
    myDataReader1 = cmd1.ExecuteReader()
    Dim hello As String
    If myDataReader1.HasRows Then

        Do While myDataReader1.Read()
            hello= myDataReader1("hello").ToString()

        Loop
        lblhello.Text = hello
    Else
        lblhello.Text = ""
    End If


    myDataReader1.Close()  

my data output should be like:

hihi,yoyo,heyhey

but i ended up getting

heyhey

only please help me on this issue



via Chebli Mohamed

how to create message box in public static void method

I have a public static method and I would like a message to be displayed if certain values are selected. This is in asp.net so adding using System.Windows.Forms; causes problems because I am using using System.Web.UI.WebControls;. So how do I create a message?

public static void UpdateSerialQtyRcvd(int SerNoID, int QtyRcvd)
     {
            if (SerNo.QtyRcvd != 1)
            {
                if (SerNo.Reason == "")
                {
                    //message
                }
            }
        }



via Chebli Mohamed