Solved

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

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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need syntax help building hyperlink 2 40
Problem to copy file 14 49
Calculating percentage 2 29
YouTube API get the Video Tags - vb.net 7 28
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…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…

756 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