This is a migrated thread and some comments may be shown as answers.

[Solved] databinding issues

9 Answers 192 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 15 Jun 2009, 03:30 PM
Hi i have databinding problems using the following code
            string Connection = "Data Source=62.197.41.101; Initial Catalog=PilotWebApp; User ID=sa; Pwd=medularis;";  
 
            strPropref = Request.QueryString["Propref"];  
              
            SqlConnection conn = new SqlConnection(Connection);  
            SqlCommand cmd = new SqlCommand("slot_sp_EngineerTimeslots", conn);  
            cmd.CommandType = CommandType.StoredProcedure;  
            cmd.Parameters.AddWithValue("@PROPREF", strPropref);  
            cmd.Parameters.AddWithValue("@iSTARTDATE", RadCalendar1.SelectedDate);  
            cmd.Parameters.AddWithValue("@JOBLENGTH""30");  
            cmd.Parameters.AddWithValue("@TIMESLOT", RadAppointment.SelectedValue);  
            conn.Open();  
            SqlDataReader reader = cmd.ExecuteReader();  
            DataTable dt = new DataTable();  
            dt.Load(reader);  
            RadGrid1.DataSource = dt;  
            RadGrid1.DataBind(); 
the code compiles and runs but the grid doesnt show any information and when i put the cursor over the datatable there are 44 records

9 Answers, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 08:28 AM
we also have a rendering issue on the grid when the data now seems to be getting across to the grid but its then not rendering properly
0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 08:41 AM
we have also found that we lose the button on the radtimepicker when the rebind is done on the grid is there anyreason for this?
0
Iana Tsolova
Telerik team
answered on 16 Jun 2009, 09:12 AM
Hello Kevin,

I suggest that you try binding your grid through the NeedDataSource event and see if it makes any difference.

Find more about RadGrid data-binding in the below online resources:
http://www.telerik.com/help/aspnet-ajax/grddatabindingbasics.html
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx

Let me know how it goes.

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 09:22 AM
Hello Lana

that hasnt worked im still not able to get the grid to databind properly if i put the code on page load then it works but else where it doesnt?

Thanks for your help on this
0
Iana Tsolova
Telerik team
answered on 16 Jun 2009, 09:28 AM
Hi Kevin,

You need to put the code only in the NeedDataSource event handler and ought to remove the DataBind() call. Additionally, you need to remove all DataBind() calls on the page as the method should not be used when grid is bound through the NeedDataSource. Could you check that out?

Best wishes,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 09:33 AM
Hello Lana

That has worked a treat thank you very much for your help!

0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 09:33 AM
Hello Lana

That has worked a treat thank you very much for your help!

0
Kevin
Top achievements
Rank 1
answered on 16 Jun 2009, 10:13 AM
It has stopped working i have the needs data source in my code but the grid is now not being data bound is there anything else that i can do?
0
Iana Tsolova
Telerik team
answered on 18 Jun 2009, 01:10 PM
Hello Kevin,

Could you please try sending the whole problematic page, or at least any code connected to the grid, ajax settings, etc., so I could get better idea of your scenario and implementation and see if I can find thus what could have caused the issue?

Sincerely yours,
Iana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or