all groups > asp.net datagrid control > september 2006 >
You're in the asp.net datagrid control group:
How do i debug a datagrid problem ?
asp.net datagrid control:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. I'm trying to display a datagrid on my web form using this code: Me.tripsDataGrid.DataSource = Me.tripsDataSet Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString Me.tripsDataGrid.DataBind() It displays the DataGrid on the form with the column headers but no data rows. The data is in the tripsTable rows because i can display them in the debugger. How do i debug this to figure out why it is not populating the datagrid ? Any help would be gratefully appreciated. Thanks, Tony
I don't know if this would make a difference, but everything looks OK in your code with the possible exception of the following line: Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString I'd suggest replacing the right side of the expression with the name of the table as a String, like so (I'm guessing at the name of the table within your DataSet): Me.tripsDataGrid.DataMember = "trips" The reason I'm suggesting this is because I seem to remember a similar problem that was related to the DataMember being set incorrectly. You could also set a breakpoint on this line (without the modification), run the app in Debug mode and see what "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did notice that the ToString method of a System.Data.DataTable returns "the TableName and DisplayExpression, if there is one as a concatenated string", so one possibility is that there is a DisplayExpression, which would cause problems when you assign the DataMember. If my suggestion works and you still want to assign the DataMember dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which contains just the name of the table as a String. [quoted text, click to view] "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message news:egp9Zhp4GHA.1848@TK2MSFTNGP06.phx.gbl... > Hello. > > I'm developing and testing a web application using VS.NET 2003, VB, .NET > Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 > computer. I'm using a web form. > > I'm trying to display a datagrid on my web form using this code: > Me.tripsDataGrid.DataSource = Me.tripsDataSet > Me.tripsDataGrid.DataMember = > Me.tripsDataSet.tripsTable.ToString > Me.tripsDataGrid.DataBind() > > It displays the DataGrid on the form with the column headers but no data > rows. The data is in the tripsTable rows because i can display them in > the debugger. > > How do i debug this to figure out why it is not populating the datagrid ? > > Any help would be gratefully appreciated. > > Thanks, > Tony >
Are you loading the data into the table before you call the DataGrid's DataBind method? I know you said that the data is in the tripsTable rows because you can display them in the debugger, but did you check that just before the DataBind call? [quoted text, click to view] "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message news:uNmTgF04GHA.3404@TK2MSFTNGP04.phx.gbl... > Hello Brian. > > I tried all of your suggestions and nothing worked. However, i did notice > that the line "Me.tripsDataSet.tripsTable.TableName" does yield the > correct table name, so i will probably stay with that in my coding. > > All i need to do now is figure out why the grid is empty. > > Thanks, > Tony > > "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message > news:OwE7Wmz4GHA.3600@TK2MSFTNGP03.phx.gbl... >>I don't know if this would make a difference, but everything looks OK in >>your code with the possible exception of the following line: >> >> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString >> >> I'd suggest replacing the right side of the expression with the name of >> the table as a String, like so (I'm guessing at the name of the table >> within your DataSet): >> >> Me.tripsDataGrid.DataMember = "trips" >> >> The reason I'm suggesting this is because I seem to remember a similar >> problem that was related to the DataMember being set incorrectly. >> >> You could also set a breakpoint on this line (without the modification), >> run the app in Debug mode and see what >> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did >> notice that the ToString method of a System.Data.DataTable returns "the >> TableName and DisplayExpression, if there is one as a concatenated >> string", so one possibility is that there is a DisplayExpression, which >> would cause problems when you assign the DataMember. >> >> If my suggestion works and you still want to assign the DataMember >> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which >> contains just the name of the table as a String. >> >> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message >> news:egp9Zhp4GHA.1848@TK2MSFTNGP06.phx.gbl... >>> Hello. >>> >>> I'm developing and testing a web application using VS.NET 2003, VB, .NET >>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 >>> computer. I'm using a web form. >>> >>> I'm trying to display a datagrid on my web form using this code: >>> Me.tripsDataGrid.DataSource = Me.tripsDataSet >>> Me.tripsDataGrid.DataMember = >>> Me.tripsDataSet.tripsTable.ToString >>> Me.tripsDataGrid.DataBind() >>> >>> It displays the DataGrid on the form with the column headers but no data >>> rows. The data is in the tripsTable rows because i can display them in >>> the debugger. >>> >>> How do i debug this to figure out why it is not populating the datagrid >>> ? >>> >>> Any help would be gratefully appreciated. >>> >>> Thanks, >>> Tony >>> >> >> > >
Hello Brian. I tried all of your suggestions and nothing worked. However, i did notice that the line "Me.tripsDataSet.tripsTable.TableName" does yield the correct table name, so i will probably stay with that in my coding. All i need to do now is figure out why the grid is empty. Thanks, Tony [quoted text, click to view] "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message news:OwE7Wmz4GHA.3600@TK2MSFTNGP03.phx.gbl... >I don't know if this would make a difference, but everything looks OK in >your code with the possible exception of the following line: > > Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString > > I'd suggest replacing the right side of the expression with the name of > the table as a String, like so (I'm guessing at the name of the table > within your DataSet): > > Me.tripsDataGrid.DataMember = "trips" > > The reason I'm suggesting this is because I seem to remember a similar > problem that was related to the DataMember being set incorrectly. > > You could also set a breakpoint on this line (without the modification), > run the app in Debug mode and see what > "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did > notice that the ToString method of a System.Data.DataTable returns "the > TableName and DisplayExpression, if there is one as a concatenated > string", so one possibility is that there is a DisplayExpression, which > would cause problems when you assign the DataMember. > > If my suggestion works and you still want to assign the DataMember > dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which > contains just the name of the table as a String. > > "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message > news:egp9Zhp4GHA.1848@TK2MSFTNGP06.phx.gbl... >> Hello. >> >> I'm developing and testing a web application using VS.NET 2003, VB, .NET >> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 >> computer. I'm using a web form. >> >> I'm trying to display a datagrid on my web form using this code: >> Me.tripsDataGrid.DataSource = Me.tripsDataSet >> Me.tripsDataGrid.DataMember = >> Me.tripsDataSet.tripsTable.ToString >> Me.tripsDataGrid.DataBind() >> >> It displays the DataGrid on the form with the column headers but no data >> rows. The data is in the tripsTable rows because i can display them in >> the debugger. >> >> How do i debug this to figure out why it is not populating the datagrid ? >> >> Any help would be gratefully appreciated. >> >> Thanks, >> Tony >> > >
Brian. Yes. I just checked it again. Very strange. When i use this statement: Me.tripsDataGrid.DataSource = Me.tripsDataSet It display the empty grid with the column name across the top. If i use this statement: Me.tripsDataGrid.DataSource = Me.tripsDataSet.DataSetName It displays the grid with one column named "Item" and puts the name of the dataset under it one letter at a time like this: t r i p s D S Thanks, Tony [quoted text, click to view] "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message news:e65ecN04GHA.292@TK2MSFTNGP02.phx.gbl... > Are you loading the data into the table before you call the DataGrid's > DataBind method? I know you said that the data is in the tripsTable rows > because you can display them in the debugger, but did you check that just > before the DataBind call? > > "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message > news:uNmTgF04GHA.3404@TK2MSFTNGP04.phx.gbl... >> Hello Brian. >> >> I tried all of your suggestions and nothing worked. However, i did >> notice that the line "Me.tripsDataSet.tripsTable.TableName" does yield >> the correct table name, so i will probably stay with that in my coding. >> >> All i need to do now is figure out why the grid is empty. >> >> Thanks, >> Tony >> >> "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message >> news:OwE7Wmz4GHA.3600@TK2MSFTNGP03.phx.gbl... >>>I don't know if this would make a difference, but everything looks OK in >>>your code with the possible exception of the following line: >>> >>> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString >>> >>> I'd suggest replacing the right side of the expression with the name of >>> the table as a String, like so (I'm guessing at the name of the table >>> within your DataSet): >>> >>> Me.tripsDataGrid.DataMember = "trips" >>> >>> The reason I'm suggesting this is because I seem to remember a similar >>> problem that was related to the DataMember being set incorrectly. >>> >>> You could also set a breakpoint on this line (without the modification), >>> run the app in Debug mode and see what >>> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did >>> notice that the ToString method of a System.Data.DataTable returns "the >>> TableName and DisplayExpression, if there is one as a concatenated >>> string", so one possibility is that there is a DisplayExpression, which >>> would cause problems when you assign the DataMember. >>> >>> If my suggestion works and you still want to assign the DataMember >>> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which >>> contains just the name of the table as a String. >>> >>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message >>> news:egp9Zhp4GHA.1848@TK2MSFTNGP06.phx.gbl... >>>> Hello. >>>> >>>> I'm developing and testing a web application using VS.NET 2003, VB, >>>> .NET >>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 >>>> computer. I'm using a web form. >>>> >>>> I'm trying to display a datagrid on my web form using this code: >>>> Me.tripsDataGrid.DataSource = Me.tripsDataSet >>>> Me.tripsDataGrid.DataMember = >>>> Me.tripsDataSet.tripsTable.ToString >>>> Me.tripsDataGrid.DataBind() >>>> >>>> It displays the DataGrid on the form with the column headers but no >>>> data rows. The data is in the tripsTable rows because i can display >>>> them in the debugger. >>>> >>>> How do i debug this to figure out why it is not populating the datagrid >>>> ? >>>> >>>> Any help would be gratefully appreciated. >>>> >>>> Thanks, >>>> Tony >>>> >>> >>> >> >> > >
Hello Brian. I deleted all my data controls and started over and created a new datagrid. Now the grid displays on my web form filled with sample data, which is something it was not doing before. I also noticed that it allows me to use the property page for the datagrid to select the DataSource and DataMember properties in the dropdown list fashion, another thing it was not doing before. But i'm still having the same problem. It displays the Datagrid headings but not the data from the typed dataset. I also tried assigning the datasource and datamemeber dynamically. Do you have any other ideas of what to try ? Thanks, Tony [quoted text, click to view] "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message news:eLWKgP14GHA.1188@TK2MSFTNGP05.phx.gbl... > Brian. > > Yes. I just checked it again. Very strange. When i use this statement: > Me.tripsDataGrid.DataSource = Me.tripsDataSet > > It display the empty grid with the column name across the top. > > If i use this statement: > Me.tripsDataGrid.DataSource = Me.tripsDataSet.DataSetName > > It displays the grid with one column named "Item" and puts the name of the > dataset under it one letter at a time like this: > t > r > i > p > s > D > S > > Thanks, > Tony > > "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message > news:e65ecN04GHA.292@TK2MSFTNGP02.phx.gbl... >> Are you loading the data into the table before you call the DataGrid's >> DataBind method? I know you said that the data is in the tripsTable rows >> because you can display them in the debugger, but did you check that just >> before the DataBind call? >> >> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message >> news:uNmTgF04GHA.3404@TK2MSFTNGP04.phx.gbl... >>> Hello Brian. >>> >>> I tried all of your suggestions and nothing worked. However, i did >>> notice that the line "Me.tripsDataSet.tripsTable.TableName" does yield >>> the correct table name, so i will probably stay with that in my coding. >>> >>> All i need to do now is figure out why the grid is empty. >>> >>> Thanks, >>> Tony >>> >>> "Brian Foree" <Brian.Foree@dshs.state.tx.us> wrote in message >>> news:OwE7Wmz4GHA.3600@TK2MSFTNGP03.phx.gbl... >>>>I don't know if this would make a difference, but everything looks OK in >>>>your code with the possible exception of the following line: >>>> >>>> Me.tripsDataGrid.DataMember = Me.tripsDataSet.tripsTable.ToString >>>> >>>> I'd suggest replacing the right side of the expression with the name of >>>> the table as a String, like so (I'm guessing at the name of the table >>>> within your DataSet): >>>> >>>> Me.tripsDataGrid.DataMember = "trips" >>>> >>>> The reason I'm suggesting this is because I seem to remember a similar >>>> problem that was related to the DataMember being set incorrectly. >>>> >>>> You could also set a breakpoint on this line (without the >>>> modification), run the app in Debug mode and see what >>>> "Me.tripsDataSet.tripsTable.ToString" evaluates to at that point. I did >>>> notice that the ToString method of a System.Data.DataTable returns "the >>>> TableName and DisplayExpression, if there is one as a concatenated >>>> string", so one possibility is that there is a DisplayExpression, which >>>> would cause problems when you assign the DataMember. >>>> >>>> If my suggestion works and you still want to assign the DataMember >>>> dynamically, you could try Me.tripsDataSet.tripsTable.TableName, which >>>> contains just the name of the table as a String. >>>> >>>> "Tony Girgenti" <tony(nospam)@lakesideos.com> wrote in message >>>> news:egp9Zhp4GHA.1848@TK2MSFTNGP06.phx.gbl... >>>>> Hello. >>>>> >>>>> I'm developing and testing a web application using VS.NET 2003, VB, >>>>> .NET >>>>> Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 >>>>> computer. I'm using a web form. >>>>> >>>>> I'm trying to display a datagrid on my web form using this code: >>>>> Me.tripsDataGrid.DataSource = Me.tripsDataSet >>>>> Me.tripsDataGrid.DataMember = >>>>> Me.tripsDataSet.tripsTable.ToString >>>>> Me.tripsDataGrid.DataBind() >>>>> >>>>> It displays the DataGrid on the form with the column headers but no >>>>> data rows. The data is in the tripsTable rows because i can display >>>>> them in the debugger. >>>>> >>>>> How do i debug this to figure out why it is not populating the >>>>> datagrid ? >>>>> >>>>> Any help would be gratefully appreciated. >>>>> >>>>> Thanks, >>>>> Tony >>>>> >>>> >>>> >>> >>> >> >> > >
Don't see what you're looking for? Try a search.
|
|
|