Solved

Telerik RadGrid not populating my dropdown and monthyearpickers with correct info.

Posted on 2007-03-19
4
4,707 Views
Last Modified: 2008-01-09
Hello again Experts,
Here's another question about using the RadGrid provided by telerik. v.3.5. I have a radgrid set up for address history information. My "Update" and "Insert" commands and "Add new record" and all that is working fine, but when I click the Edit command column on a certain row to edit that row of data, I can't get the States dropdown to populate the right state in there. It just keeps populating with Alabama just like if you clicked the "Add new record" button to add a new row of data. Everything else is working fine as far as connecting to my SQL database and everything. The RowID is working like a champ, I just can't get it to stick the right state in there, for example, if that row of data is 101 somewhere, somecity NY, it doesn't populate with NY but AL again. Driving me crazy. Also, I have 2 Peter Blum MonthYearPickers embedded in the RadGrid so the client can select the FromDate and the ToDate that they lived at a particular address and it's not populating those either, they're just populating with the computer's time as of today.

Thanks, RunForrestRun
0
Comment
Question by:RunForrestRun
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 37

Expert Comment

by:samtran0331
ID: 18758391
have a look at this thread off the telerik site. there's a zip with sample code also...and the same technique should also work for the MonthYearPickers as well...
http://www.telerik.com/community/forums/thread/b311D-gecht.aspx
0
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 18758401
ps...

EE is definitely the place to go for most programming questions...but the telerik support team is really on the ball for answering questions specific to their controls
0
 

Author Comment

by:RunForrestRun
ID: 18779894
Thanks samtran0331, many points to you,
I ended up submitting a support ticket to Telerik and they emailed me some more code that I added to the ItemDataBound event in the lines that are at the bottom starting with Dim editedItem As GridEditableItem.
Also, to get the MonthYearPickers to work I emailed Peter Blum and what I was doing wrong was, I had "text" instead of "xDateTime" on this line xDateTime='<%# DataBinder.Eval( Container, "DataItem.FromDate" ) %>'. Peter had me to change that and now everything is working GREAT whenever I click the "Edit" button to edit a row of information. Hope this helps someone in the future.
 

Private Sub ResHistoryGrid_ItemDataBound(ByVal sender As Object, ByVal e As  Telerik.WebControls.GridItemEventArgs) Handles ResHistoryGrid.ItemDataBound

        If (TypeOf e.Item Is GridEditableItem AndAlso e.Item.IsInEditMode) Then

            Dim item As GridEditableItem = e.Item

            'access/modify the edit item template settings here

            Dim ddl_StateHistory As Telerik.WebControls.RadComboBox =     item.FindControl("ddl_StateHistory")
            dbCnx.Open()
            dbCmd = New SqlCommand("SELECT StateCode, StateName FROM State_List ORDER BY StateName", dbCnx)
            dbRdr = dbCmd.ExecuteReader
            ddl_StateHistory.DataSource = dbRdr
            ddl_StateHistory.DataValueField = "StateCode"
            ddl_StateHistory.DataTextField = "StateName"
            ddl_StateHistory.DataBind()
            dbRdr.Close()
            dbCnx.Close()

            Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem)
            Dim boxState As Telerik.WebControls.RadComboBox = CType(editedItem.FindControl("ddl_StateHistory"), Telerik.WebControls.RadComboBox)
            boxState.SelectedValue = DataBinder.Eval(e.Item.DataItem, "State").ToString()

        End If

    End Sub 'ResHistoryGrid_ItemDataBound
0
 
LVL 37

Expert Comment

by:samtran0331
ID: 18780024
Glad you got it working RunForrestRun.

...I didn't really help you besides telling you where to go to get real help...lol.

But thanks for the points!!!
...this question was the one that pushed me over the 1million mark and into "Genius" level!

Sam
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question