Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1082367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:17:15+00:00 2026-05-16T22:17:15+00:00

I am relativity new to asp.net programming, so this one has me stumped. I

  • 0

I am relativity new to asp.net programming, so this one has me stumped. I manually created a dataset and set its value to the Datasource of the GridView control and then call the Databind method, but it isn’t refreshing. I recreated a simple version of what I am doing so someone can advise me what I am doing wrong. I didn’t include the Master file, as I didn’t see it as pertainent.

Code for ASP page

<%@ Page Language="vb" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="TestGridView._Default" %>

Updating price please stand by.

<p>
    <asp:GridView ID="GV1" runat="server" AutoGenerateColumns="false">
    <Columns>
        <asp:BoundField DataField="VendorNumber" HeaderText="Vendor" />
        <asp:BoundField DataField="PartNumber" HeaderText="Part or Sku" />
        <asp:BoundField DataField="Message" HeaderText="Error Message" />
    </Columns>
    </asp:GridView>
</p>
<br />
<br />
<%
    If Not Page.IsPostBack Then
        Response.Write(Me.UpdatePricing())

    End If
%>    

Code for Code Behind

Public Class _Default
Inherits System.Web.UI.Page

Public Function UpdatePricing() As String
    Dim showerrors As Boolean = False

    Dim Head As New PnAHead()

    Dim ds As DataSet = Head.GetErrorDataset()

    If (ds.Tables("Errors").Rows.Count > 0) Then
        showerrors = True
    End If

    If showerrors Then
        GV1.DataSource = ds
        GV1.DataBind()
    End If

    Return "Sales Line Number has been updated."
End Function

End Class

Class that creates the Dataset

Public Class PnAHead

Public Function GetErrorDataset() As DataSet
    Dim dstemp = New DataSet()
    Dim tbl As DataTable = dstemp.Tables.Add("Errors")
    Dim col As DataColumn = tbl.Columns.Add("VendorNumber", System.Type.GetType("System.String"))
    col.MaxLength = 20

    col = tbl.Columns.Add("PartNumber", System.Type.GetType("System.String"))
    col.MaxLength = 50

    col = tbl.Columns.Add("Message", System.Type.GetType("System.String"))
    col.MaxLength = 500

    Dim row As DataRow

    row = tbl.NewRow()

    row("VendorNumber") = "Vendor 1"
    row("PartNumber") = "Part Number 1"
    row("Message") = "Message for Part 1"

    tbl.Rows.Add(row)

    row = tbl.NewRow()

    row("VendorNumber") = "Vendor 2"
    row("PartNumber") = "Part Number 2"
    row("Message") = "Message for Part 2"

    tbl.Rows.Add(row)

    Return dstemp
End Function

End Class

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:17:16+00:00Added an answer on May 16, 2026 at 10:17 pm

    You need to add your call to update pricing into the Page_Load event. You can also remove the Response.Write().

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      If Not Page.IsPostBack Then
          Me.UpdatePricing()
      End If
    End Sub
    

    You can do this in the .aspx page by wrapping the Page_Load event in script tags, like this:

    <script type="text/VB" runat="server">
    
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            Me.UpdatePricing()
        End If
    End Sub
    
    </script>
    

    Or you can just add the Page_Load event to your code behind, which i think is preferable as you already have a code behind page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am relatively new to ASP.NET programming, and web programming in general. We have
I'm relatively new to ASP.NET MVC so I'm having a little trouble with this
I am relatively new to this, but here is my problem. In asp.net, I
I am relatively new to ASP.NET MVC, and am very impressed with the clarity
I am relatively new to website design and specifically working in ASP.NET, i am
I'm thinking over an ASP.NET application that uses ESENT for persistance. At this point
I am relatively new to ASP.NET & C# I am creating a basic form
My scenario is this - I have two ASP.net websites. Both sites run on
I am relatively new to ASP.NET so I do not know the usual practice
I've just recently fallen in love with the world of ASP.NET MVC, and one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.