ADO.NET :: Working With Dataset And Gridview To Display Data On Web Form?
Jul 26, 2010
I'm a bit new to VB .NET programming. I was given a project to build a web page for our Shipping department to pull up some order & invoice numbers, based on an order number parameter.
Basically, what I'm trying to do is, when the user enters an order number, I want the web page to display the invoices & invoice dates that are associated with the order number.
I've put together some code already, but not sure it is actually working. The web page comes up in Debugging mode and it acts like it is pulling data from the Oracle database, but nothing shows up in the Gridview (which I bound to the dataset... I think).
[Code]....
Being new to VB, I'm guessing my code may not be totally correct. I've tried lots of things and done tons of searching on Google, but nothing I've tried seems to work. At this point, I'm not even sure if the dataset is being populated correctly or at all either. I'm a bit lost right now and could use some expert thoughts.
In case it helps, my dataset has one data table in it (dtShipData). My dataset class is sdDataSet. I added 3 columns to the data table and the gridview, manually. Not sure if should do that or not. I don't have any SQL behind the datatable itself...
View 47 Replies
Similar Messages:
Jan 13, 2010
If the gridview binds to empty dataset, I need to still show a gridview so that users can ADD more using the textfields in the bottom of the footer template. Since the gridview is empty it won't bind not allowing rendering of the <footer template> I guess I should create a empty dataset if the gridview is empty. How do I check for this and can this be done in GridviewRowEventArgs
View 5 Replies
Jan 21, 2010
I need to know how to display a single row(or particular row)from dataset and display into gridview... i tried by using some codes, like the following, If strCourseLevelId <> "" Then Dim ds2 As DataSet Dim currentbundlenid As Int16 Dim prevbundleid As Int16 = "0" Dim bundlenos As Int16 = "0" Dim bundlecontent As Bundledata = New Bundledata ds2 = bundlecontent.GetBundleData(strCourseLevelId) If ds2.Tables.Count = 1 Then If ds2.Tables(0).Rows.Count > 0 Then With ds2.Tables(0) Dim strCnt As Int16 For strCnt = 0 To .Rows.Count - 1 With .Rows(strCnt) currentbundlenid = .Item("Bundleid") If currentbundlenid <> prevbundleid Then bundlenos = bundlenos + 1 End If If bundlenos = "1" Then GridView1.DataSource = ds2 GridView1.DataBind() ElseIf bundlenos = "2" Then GridView2.DataSource = ds2 GridView2.DataBind() ElseIf bundlenos = "3" Then GridView3.DataSource = ds2 GridView3.DataBind() End If prevbundleid = .Item("Bundleid") 'next write the main page content End With Next End With End If End If.
View 5 Replies
Aug 23, 2010
I have the following code:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Oracle.DataAccess.Client; // ODP.NET Oracle managed provider
using Oracle.DataAccess.Types;
namespace MyTestApp {
public partial class _Default : System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
OracleConnection conn = new OracleConnection("User Id=UID; Password=PWD; Data Source=XE; Pooling=false"); try { conn.Open(); } catch ( OracleException oe ){
Console.WriteLine("ERROR : " + oe.Message); }
if ( !Page.IsPostBack ) {
if (conn.State == ConnectionState.Open) {
// get data GetMoleculesToShow(conn); } }
// clean up connection conn.Dispose(); }
static void GetMoleculesToShow( OracleConnection conn ){
String division; String rxotc; String molecule_name;
String prodnum; String proddesc; String molecule_class; String nonactive;
// create command object and set attributes
OracleCommand cmd = new OracleCommand("schema.package.procedure", conn);
cmd.CommandType = CommandType.StoredProcedure;
//Bind values
cmd.Parameters.Add("mol_to_show_cur", OracleDbType.RefCursor);
cmd.Parameters[0].Direction = ParameterDirection.Output; try {
// Execute command, have parameters populated cmd.ExecuteNonQuery();
// Create OracleDataAdapter, data provider object to populate dataset
OracleDataAdapter da = new OracleDataAdapter(cmd);
//Populate dataset with "molrefcur"
DataSet ds = new DataSet();
da.Fill(ds, "mol_to_show_cur", (OracleRefCursor)(cmd.Parameters["mol_to_show_cur"].Value));
//Verify dataset is begin populated //DataTable dt = ds.Tables[0];
//foreach ( DataRow dr in ds.Tables[0].Rows ) //{
// division = dr["division"].ToString();
// rxotc = dr["rxotc"].ToString();
// molecule_name = dr["molecule_name"].ToString();
// prodnum = dr["prodnum"].ToString();
// proddesc = dr["proddesc"].ToString();
// molecule_class = dr["molecule_class"].ToString();
// nonactive = dr["nonactive"].ToString(); //}
if (ds.Tables[0].Rows.Count != 0) {
// display dataset values GridView gvMolecules = new GridView();
gvMolecules.DataSource = ds.Tables["mol_to_show_cur"].Rows;
gvMolecules.DataBind(); } }
catch (OracleException oe) {
Console.WriteLine("ERROR : " + oe.Message); }
finally { cmd.Dispose(); } } } }
The dataset is being populated, however when the page renders, the data nor the gridview are visible. I have tried using both IE and Firefox, binding / not binding the columns, AutoGenerateColumns Y / N with no success. As I am new to all of this ( VS2008, ASP.NET, C# ) I can't help but to think I am overlooking something basic.
I am using the following :
- VS 2008
- MS Vista SP2
- Oracle XE ( local )
View 13 Replies
Feb 4, 2010
I want to use an XMLDataset control to read some XML data I have and display it in an ASP.NET GridView control. My data is formatted like this:
[Code]....
When everything is assigned and the page is rendered the GridView component is confuesd and cannot seem to identify the columns and data. But when the data is formatted like this, it works fine:
[Code]....
This is my question: How do I have the XML Dataset Control correctly read the XML data in my first example and display it properly without changing its format?
View 1 Replies
Dec 13, 2013
My requirement is need to develope a web page in asp.net using c#, which contain 4 textboxes 4 labels and 1 button and finally gridview.
Lables are:
1.StudentId (it shld be identity key and primary in db(automatic id updation))-textbox
2.StudentName-textbox
3.Course-dropdownlist box
4.Address-textbox
Note: studentId and name shld have validation.
Button:
1.Insert
REQUIREMENTS:
Gridview should hve edit and delete link button atlast. In c# pgm thr should be a sql connection when values are entered in textboxes after clicking Insert button it should insert value in gridview and also in database. If the edit button is clicked the values should display in textbox and their only we should update the values and main thing we click on edit link button the INSERT button should change to UPDATE button after updating the updated values it should save in gridview and also in database and after updating it should chance again to insert button.
The delete button shld delete the selected row in gridview.
View 1 Replies
Mar 31, 2011
In my project I work with Entity Framework (LINQ to ENTITY). I only have ADO.NET Entity Data Model and a DAL (Data Access Layer). I also get the data due a WCFClientService. I have a gridview that needed to be exported in Excel.
FlexCel is a tool for generating Excel files based on a template. The only thing I see in demo's is that they work with DataSets.
Is there a way to convert the data in my gridview to a virtual DataSet?
I've written the following method to get the data:
[Code]....
View 1 Replies
Aug 5, 2010
Has anyone implemented FancyBox to display a form where user can make an entry within a FancyBox dialog? I'm simply displaying an inline form within a FancyBox dialog but my button is not firing.If I do not set to style="display: none;", I can see my form i.e. a TextBox control and a Button control and it works fine. If I set it display: none so that I can show my form within a FancyBox dialog, it doesn't work.
View 4 Replies
Jan 12, 2011
I have a gridview which I am using to display a dataset result. The problem is I am using paging in it. But when I click on the page # it says that I haven't handled the event. Do I need to rebind the dataset?
View 1 Replies
Oct 8, 2010
This procedure is call from the page load:
Private Sub ImportDataFromDataset()
View 5 Replies
Jun 9, 2012
after creating a xsd dataset in one machine when i try to use the another in a application in another system though i can use it for fetching records & all i am not able to confidure it or preview data.i already have the connectin string in web config.what changes needs to be done so that the dataset from system 1 can work in ssytem2
View 1 Replies
May 21, 2010
I mean, what is the faster way to get as fast as I can more than one table with stored procedure? Is there any study what is faster and why? There is a big problem getting more than one table at once with Entities, so the only way is DataSet. But I was told DataSet work very slow. Is that true?
View 2 Replies
Sep 18, 2010
I have a asp table and working dataset.How can I bind the dataset with the table.The code is here....
<asp:table id="tblcampaign" runat="server" width="100%" border="0" cellspacing="0" cellpadding="0">
<asp:TableHeaderRow ID="content_table_heading">
<asp:TableHeaderCell Width="39"><img src="Images/table_heading_bg_lft.gif" alt="" width="39" height="41" /></asp:TableHeaderCell>
<asp:TableCell width="91">Campaign ID</asp:TableCell>
<asp:TableCell width="132">Campaign Name</asp:TableCell>
<asp:TableCell width="134">Parent Campaign</asp:TableCell>
<asp:TableCell width="121">Target Segment</asp:TableCell>
<asp:TableCell width="95">Objective</asp:TableCell>.......
.cs code is here..
MCMS.DAL.Dataset.MobileCampaign mob_cam = new MCMS.DAL.Dataset.MobileCampaign();
MCMS.BL.MobileCampaignHandler obj = new MCMS.BL.MobileCampaignHandler();
mob_cam = obj.GetCampaignDetails();
View 1 Replies
Apr 28, 2013
I was working with SSRS in windows application,when I got this error "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." I have made the property of Dataset(.xsd) EnforceConstrints to False and error gone. Whether it will impact anywhere in the application in the future or it wont have any impact.
View 1 Replies
Jun 8, 2012
i am creating a dataset from SP Sp when executed in query analyser dislays the output but when i used the same for creating datset , its created but i dont get any columns i checked the xsd in notepad but there is no column source names
View 1 Replies
Jan 15, 2010
I have a Listview control that DataBind programatically... ie I am NOT using SqlDataSource or such... I am attempting to sort a column... clicking on a link button that fires the "Sorting" event. So, after cliking on the column heading... I end up in this routine, where I hardcoded the .Sort = values (just for testing). The code is executed... but the RESULT show via Listview remains the SAME. No change!
How to fix this? I've seen some other posts examples that uses this event (ListView1_Sorting) and then sort via LINQ. I am not ready to try that...
Just want to know why dsPaymentList.Tables[0].DefaultView.Sort does not work?
I followed the example at: [URL]
protected void ListView1_Sorting(object sender, ListViewSortEventArgs e)
{
string sortExpression = e.SortExpression + " " + e.SortDirection;
DataSet dsPaymentList = new DataSet();
[Code]....
View 3 Replies
May 27, 2010
i want to display the hierarchial data in a tree View from the DataSet. using XML and XSLT how can i achive this?
View 3 Replies
Jul 19, 2010
i have dataset containing multiple images in binary format,how i can use handler to display those images from dataset which i am having,without needing to pass id in query string to handler each time?
View 4 Replies
Jan 13, 2010
I've been given this existing web service [URL] and I need to use the GetQuoteDataSet method to display the dataset in a Grid View control on my aspx page, anyone got any clue as to how I could do this?
View 3 Replies
Jul 14, 2010
I am having a problem with this code, i had a post on this however this code is slightly different to that so i thought i would post a spearate thread.
Anyway, what i am trying to do is display job vacancies by the result of a DropDownList value. Now each job name has a description. The problem i am having is i need to display the results in this logic:
Job nameJob descriptionJob location. But what is happening is the job description (body) is repeating the more vacancies there are. This is the page:
http://kidsunlimited.co.uk/vacancies_test_two.aspx
If you select Deputy Nursery Manager from the DropDown and hit the Search button you will see the results. After listing the first two locations the description is repeated and then the 3rd location is shown after this. This is my code:
[Code]....
View 7 Replies
Dec 10, 2010
I have a set of dataset with different column retrieved from DB. I need to present the datasets in one GridView (or other ListView etc...) without specifying the column_header. It should present automaticly since the GridView is bind to the DataSet.
In additional, I want this GridView to handle multiple rows edit and update the dataset, idealy, show data in textboxs in initially.How could I set the GridView to edit_model without hardcode column_header and textboxs in 'itemtemplate' or filed.
How could I achieve the bulk edit and update, so that I can assign 'mydataview1.table' to the dataset.
View 1 Replies
Dec 21, 2010
I have a detailsview, template as follows:
[Code]....
Codebehind: creating dataset, getting data from sql with adaptor and filling into dataset object, then setting detailsview's datasource.
I add 2 button to above template to able to edit data at asp page, and added event handlers:buttons:
[Code]....
My question is, what to do inside the detailsview update event function to able to edit and update data. My method can be wrong too.
View 7 Replies
Mar 19, 2010
there is one dynamic page, that, from a database, based on a lot of gathered information (user id, account #, etc), actually 'spits' out an html form, with an action which goes to a website and sends a bunch of hidden information from our site.y situation is this - I am building a master page for the site, which will include the form tag for the content pagesdon't see how this will work, without rewriting what comes from the database - - -
View 8 Replies
Mar 16, 2010
I am having set of data like UserName, Address and image. I am having this information in Dataset. I need to show these information in Web page like
User1 User2
User3 User4
User5 User6
I try to display the data using DataList, but this is display all users Vertically. But i need to split into twocolumns and show the data.
How can i achieve this, which control should i use?
View 4 Replies
Nov 30, 2011
I have a gridview to which i am adding rows dynamically at the click event of a button placed in gridview footer template. When i want to update data. I have to load the gridview with all the rows required. I get the sql table data in the dataset object and then i have to load this in the gridview. How can i do this? Only one row gets loaded when i use this code:
DataSet DSContact = DMLObj.Load_DataSet("Usp_LoadData", "ContactPerson", idf); foreach (GridViewRow row in GVContactPerson.Rows) { ((TextBox)row.FindControl("txtContactName")).Text=DSContact.Tables[0].Rows[0]["ContactName"].ToString(); ((TextBox)row.FindControl("txtemail")).Text = DSContact.Tables[0].Rows[0]["ContactEmailID"].ToString(); ((TextBox)row.FindControl("txtmob1")).Text = DSContact.Tables[0].Rows[0]["ContactMobile"].ToString(); Session["contact"] = ((TextBox)row.FindControl("txtContactName")).Text; string pid = Convert.ToString(DMLObj.getid("Select ContactPersonID from tbl_ContactPersonDetails where ContactName='" + Session["contact"].ToString() + "'")); Session["contactID"] = pid; }
View 1 Replies