Solved

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

Posted on 2007-03-19
4
4,692 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
  • 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now