Solved

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

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

710 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