Results 1 to 5 of 5
  1. #1

    Default asp.net gridview


    mga master unsaon pag populate sa gridview sa asp.net?

    Code:
    Public Function subj() As DataView         Dim SelectQry = "select * from subject"         Dim SampleSource As New DataSet         Dim TableView As DataView         Try             Dim SampleCommand As New OleDbCommand()             Dim SampleDataAdapter = New OleDbDataAdapter()             SampleCommand.CommandText = SelectQry             SampleCommand.Connection = mconn             SampleDataAdapter.SelectCommand = SampleCommand             SampleDataAdapter.Fill(SampleSource)             TableView = SampleSource.Tables(0).DefaultView         Catch ex As Exception             Throw ex         End Try         Return TableView     End Function
    naay koy code but for vb.net
    sorry i am really into vb jud pure its my first time to deal with asp
    unsaon naku pag code same way sa code naku for asp.net?
    please mga masters i need help jud.

  2. #2

    Default Re: asp.net gridview

    if kabaw ka mo populate bro using vb.net, then mao nana. asp.net needs vb.net or c# for code behind.

  3. #3

    Default Re: asp.net gridview

    Most likely the same rana sila og way pag code bro. Check the code below.

    Code:
    Public Dataview subj()
    {
      string selectQry = "select * from subject";
      Dataset sampleSource = new Dataset;
      DataView tableView = new DataView;
      Try
      {
        OleDbCommand sampleCommand = New OleDbCommand();
        OleDbDataAdapter sampleDataAdapter = New OleDbDataAdapter();
        sampleCommand.CommandText = SelectQry;
        sampleCommand.Connection = mconn;
        sampleDataAdapter.SelectCommand = sampleCommand;
        sampleDataAdapter.Fill(SampleSource);
        tableView = SampleSource.Tables(0).DefaultView;
      }
      Catch(Exception e)
      {
       throw(e);
      }
      Return tableView;	
    }

  4. #4

    Default Re: asp.net gridview

    As the other member already stated, using VB.NET doesn't really matter when you are in the context of ASP.NET since you will have to use VB.NET or C# as your code behind. There are lots of way to bind your GridView with data from your database. If you're lazy you can take advantage of the ASP.NET server controls such as SqlDataSource, ObjectDataSource etc.. These controls is easy to configure it's a wizard type. All you need to do is configure the control and wire it up to your GridView and then you're good to go. Here's one example: How to bind GridView control with SqlDataSource control

    Alternatively you can code it by hand using the ADO.NET way (my preferred). Binding GridView with Data - The ADO.NET way

    Or if you want you can use LINQ to manipulate your data and display it on the browser.

  5. #5

    Default Re: asp.net gridview

    When binding data sa gridview set ra ang datatable as datasource. Then call DataBind.

  6.    Advertisement

Similar Threads

 
  1. ASP.net webhosting?
    By kempee in forum Websites & Multimedia
    Replies: 1
    Last Post: 04-07-2009, 01:09 PM
  2. ASP.NET Gridview column width
    By DeathFox in forum Programming
    Replies: 2
    Last Post: 08-08-2008, 05:04 AM
  3. Replies: 4
    Last Post: 11-04-2006, 03:59 PM
  4. vb.net/asp.net
    By Drksrvnt in forum Programming
    Replies: 0
    Last Post: 08-30-2006, 01:36 PM
  5. ASP.net tutorial
    By nullvalue in forum Websites & Multimedia
    Replies: 0
    Last Post: 03-28-2006, 04:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top