You must Sign In to post a response.
  • Category: .NET

    Add record to the list

    Hi all,

    I am newbie to dotnet. I have a question in VB.NET. I want to add the record to the already binded list. But I could not able to do it. Can anybody help me on this. Please.
  • #761681
    Hai Nihal,
    You can make use of Insert method for the list with the index and the value.
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com

  • #761692
    Hi

    You can follow this Steps

    Add NameSpace


    Imports System.Data
    Imports System.Data.SqlClient


    Add Code for insert for already binded list

    Dim sqlcon As New SqlConnection("Data source=PCNAME;Initial catalog=TestNew;Integrated Security=True;")

    sqlcon.Open()
    Dim sqlcmd As New SqlCommand("Insert into sizee values('" + txtName.Text + "')", sqlcon)
    sqlcmd.ExecuteNonQuery()

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #761711
    You can do this in two manners

    1. Postback - do the post back that time you have to rebind the list.
    2. You can refresh the list in ajax manner.

    By Nathan
    Direction is important than speed

  • #761720
    which list do you have, dropdownlist or List(Of T) class.
    please explain.
    if you want to add it in dropdownlist then here is code

    Dropdownlist1.Items.Add("New item added").

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #761911
    Hi Pawan Awasthi,

    Thanks for responding. I am struck in that, so could not proceed further. Can you please help me.

  • #761924
    Hi

    I have post the Insert code for your requirement try and let me know
    or
    share your code what is your issue?

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


Sign In to post your comments