?
Solved

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

Posted on 2007-03-19
4
Medium Priority
?
4,710 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 2000 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

Independent Software Vendors: 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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

718 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