|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Datagrid Not Displayinghtml header. I have tested the query in query analyzer. Records exist and should be displayed. I've stripped out all extraneous code to try to narrow down where the syntactic flaw is but am still coming up short. What am I missing here? I bet it's obvious... :-/ Option Strict On imports Microsoft.VisualBasic imports System imports System.Data imports System.Data.SqlClient imports System.Web imports System.Web.UI imports System.Web.UI.WebControls imports System.Web.UI.HtmlControls Public Class Tier2Grid : Inherits System.Web.UI.Page Protected DataGrid As System.Web.UI.WebControls.DataGrid Dim MyConnection As SqlConnection Dim gPoe As String Dim gVoydoc As String Public Sub Page_Load ( sender As Object, e As EventArgs ) IF (ISPOSTBACK = FALSE) THEN BindData() End If End Sub Public Sub BindData() Dim DS As DataSet Dim MyCommand As SqlDataAdapter gPoe = Request.QueryString("poe") gVoydoc = Request.QueryString("voydoc") Dim SelectCmd As String = "SELECT TOP 500 IsNull(ocean_carrier_cd, '') as 'Carrier'," _ & " IsNull(carrier_booking_nr, '') as 'Booking Num', IsNull(equipment, '') as 'Equipment'," _ & " IsNull(Van_Owner, '') as 'Van Owner', IsNull(Tcon_Container_Num,'') 'Container Num', IsNull(Event_Code,'') as 'Event Code'," _ & " IsNull(Minof315_event_date,'') as 'Sail Date', IsNull(TCN,'') as 'TCN',IsNull(POD,'') as PoD," _ & " IsNull(Ship_Name,'') as 'Ship Name',IsNull(Pcfn,'') as 'PCFN',IsNull(LastEvent,'') as 'Last Event',IsNull(lasteventloc,'') as 'LE Location'," _ & " IsNull(LastEventdt,'') as 'LE Date',IsNull(Lastevent_shipname,'') as 'LE Ship Name',IsNull(lastevent_scac,'') as 'LE SCAC'," _ & " IsNull(consigneecity,'') as 'Consignee City'" _ & " FROM firstvd WHERE voydoc = '"& gVoydoc & "' AND poe = '"& gPoe &"'" MyConnection = New SqlConnection("server=localhost;uid=itv;pwd=itv_$ql!;database=maersk_test") MyCommand = New SqlDataAdapter(SelectCmd, MyConnection) DS = new DataSet() MyCommand.Fill(DS) DataGrid.DataSource = DS DataGrid.DataBind() Response.Write(SelectCmd) End Sub Sub DataGrid_EditCommand(Sender As Object, E As DataGridCommandEventArgs) DataGrid.EditItemIndex = CInt(E.Item.ItemIndex) BindData() End Sub Sub DataGrid_CancelCommand(Sender As Object, E As DataGridCommandEventArgs) DataGrid.EditItemIndex = -1 BindData() End Sub Sub DataGrid_UpdateCommand(Sender As Object, E As DataGridCommandEventArgs) End Sub End Class Never mind. After 2 days of blank stares I naturally figure it out 5
minutes after posting it here. gah! My .aspx page looked like the below example... my columns were outside my grid. *rolling eyes at myself* <asp:datagrid> .... </asp:datagrid> <columns> .... </columns> Hrmm....
Actually, refresh this question. Heh. Now the page displays, but when I click edit, the datagrid vanishes. IOW, the page refreshes, but the datagrid is not displayed. *sigh* And scratch this one too. For those future .net newcomers who google
this in the future... try setting the enableviewstate property in your datagrid to "true." ;) > For those future .net newcomers who google Or the alternative with disabled viewstate: bind on every page load (not > this in the future... try setting the enableviewstate property in your > datagrid to "true." just when PostBack is false). :)
DataGrid with date column that is sometimes blank
PageIndexChanged problem in creating a folder.. HeaderRow Retreive values from invisible cell Data Grid Disappears after postback Multi-line datagrid Dynamically create datagrid control Sort a Datagrid with DataRelation Creating News page the dotnet way |
|||||||||||||||||||||||