Telerik Forums
UI for ASP.NET AJAX Forum
6 answers
968 views
Trying to get the selected value from the radcombobox that is in the edit item template of the radgrid.  Also trying to set the selected value when the edit command is selected.  here is the code below. In the update command i can find the control but for some reason the selected value is blank.  What about using the onSelectedIndexChanged?  is there a certain way you have to do it when the radcombobox is within the edit item template?

Thanks.

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" PageSize="10"
            AllowPaging="true" AllowSorting="true" AllowMultiRowEdit="True" 
                              AllowMultiRowSelection="true" HorizontalAlign="NotSet" OnItemCommand="RadGrid1_ItemCommand" OnUpdateCommand="RadGrid1_UpdateCommand">
                              <MasterTableView CommandItemDisplay="top" DataKeyNames="JobId" ClientDataKeyNames="JobId"
                                  EditMode="InPlace" HorizontalAlign="NotSet">
                                  <Columns>
                                      <telerik:GridEditCommandColumn ItemStyle-Width="100px" FooterText="EditCommand footer" UniqueName="EditCommandColumn"
                                          HeaderText="Edit" HeaderStyle-Width="100px" UpdateText="Update">
                                      </telerik:GridEditCommandColumn>
                                      <telerik:GridBoundColumn ItemStyle-Width="50px" HeaderStyle-Width="50px" ReadOnly="true" DataField="JobId" HeaderText="Job Id" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                      <telerik:GridTemplateColumn DataField="JobCode" HeaderText="Job Code" DataType="System.String">
                                          <ItemTemplate>
                                              <%#DataBinder.Eval(Container.DataItem, "JobId")%>
                                          </ItemTemplate>
                                          <EditItemTemplate>
                                              <telerik:RadComboBox runat="server" ID="RadComboBox1" EnableLoadOnDemand="True" DataTextField="Job Code"
                                                  OnItemsRequested="RadComboBox1_ItemsRequested" DataValueField="JobCode" AutoPostBack="false"
                                                  HighlightTemplatedItems="true" Height="140px" Width="100px" DropDownWidth="100px"
                                                  OnSelectedIndexChanged="RadComboBox1_OnSelectedIndexChanged" SelectedValue='<%#Bind("JobId")%>' >
                                              </telerik:RadComboBox>
                                          </EditItemTemplate>
                                      </telerik:GridTemplateColumn>
                                      <telerik:GridBoundColumn ReadOnly="true" DataField="Description" HeaderText="Description" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                      <telerik:GridTemplateColumn DataField="JobCodeMatch" HeaderText="Job Code Match"
                                          DataType="System.String">
                                          <ItemTemplate>
                                              <%#DataBinder.Eval(Container.DataItem, "JobCodeMatch")%>
                                          </ItemTemplate>
                                          <EditItemTemplate>
                                              <telerik:RadComboBox runat="server" ID="RadComboBox2" EnableLoadOnDemand="True" DataTextField="Job Code Match"
                                                  OnItemsRequested="RadComboBox2_ItemsRequested" DataValueField="JobCodeMatch"
                                                  AutoPostBack="false" HighlightTemplatedItems="True" Height="140px" Width="100px"
                                                  DropDownWidth="100px" OnSelectedIndexChanged="RadComboBox2_OnSelectedIndexChanged" SelectedValue='<%#Bind("JobCodeMatch")%>' >
                                              </telerik:RadComboBox>
                                          </EditItemTemplate>
                                      </telerik:GridTemplateColumn>
                                      <telerik:GridBoundColumn ReadOnly="true" DataField="LaborText" HeaderText="Labor Flag" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn ReadOnly="true" DataField="EditDate" HeaderText="Edit Date" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn ReadOnly="true" DataField="Editor" HeaderText="Editor" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                      <telerik:GridBoundColumn ReadOnly="true" DataField="Contact" HeaderText="Contact" DataType="System.String">
                                      </telerik:GridBoundColumn>
                                  </Columns>
                                  <EditFormSettings>
                                  </EditFormSettings>
                              </MasterTableView>
                              <ClientSettings>
                                  <Selecting AllowRowSelect="True" EnableDragToSelectRows="True" />
                              </ClientSettings>
                       </telerik:RadGrid>

Protected Sub OnItemDataBoundHandler(ByVal sender As Object, ByVal e As GridItemEventArgs)
    If e.Item.IsInEditMode Then
        Dim item As GridEditableItem = DirectCast(e.Item, GridEditableItem)
        Session("rcbValue") = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("JobId").ToString()
        If Not (TypeOf e.Item Is IGridInsertItem) Then
            Dim combo As RadComboBox = DirectCast(item.FindControl("RadComboBox1"), RadComboBox)
        End If
    End If
End Sub
 
Protected Sub RadComboBox1_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)  
    oData = oPassThru.GetJobCodeIds(Profile.Business) '(Profile.Business)
    Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox)
    comboBox.Items.Clear()
    For Each o As clsAdminJobCodes In oData
        Dim item As New RadComboBoxItem()
        item.Text = o.JobId.ToString()
        item.Value = o.JobId.ToString()
        comboBox.Items.Add(item)
        item.DataBind()
    Next
End Sub
  
Protected Sub RadComboBox2_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
    oData = oPassThru.GetJobCodeMatchId(Profile.Business) '(Profile.Business)
    Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox)
    comboBox.Items.Clear()
    For Each o As clsAdminJobCodes In oData
        Dim item As New RadComboBoxItem()
        item.Text = o.JobCodeMatch.ToString()
        item.Value = o.JobCodeMatch.ToString()
        comboBox.Items.Add(item)
        item.DataBind()
    Next
 End Sub
 
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
    If (e.CommandName = RadGrid.EditCommandName) Then
        Session("rcbValue") = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("JobId").ToString()
    End If
 End Sub
 
Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)
    Dim var3 As String = CType(RadGrid1.Items(0).FindControl("RadComboBox1"), RadComboBox).SelectedValue
    Dim editedItem1 As GridEditableItem = TryCast(e.Item, GridEditableItem)
    Dim var As String = CType(editedItem1.Cells(4).Controls(1), RadComboBox).SelectedValue
    Dim Var2 As String = CType(editedItem1.Controls(4).FindControl("RadComboBox2"), RadComboBox).SelectedValue
 End Sub
Simon
Telerik team
 answered on 24 Nov 2010
1 answer
519 views
I am designing a date time control using the raddatepicker.  I want Sundays to be highlighted a different color than saturday, we are open on saturdays and closed on sundays.  so mondays thru saturday (excluding holidays or special days) should be the same back ground color.

I've tried both the client and server side (OnDayRender) to control this but its too inconsistent.

What can i do differently?  Attached is the vb and javascript i am using.

Tim Martin
Car Research
             <script type="text/javascript">
                 function OnDayRender(calendarInstance, args) {
6) and Sunday (day = 0))
                                        
                     var jsDate = new Date(args.get_date()[0], args.get_date()[1] - 1, args.get_date()[2]);
                     if (jsDate.getDay() == 0) {
                         var otherMonthCssClass = "CalendarDisabled";
                         args.get_cell().className = otherMonthCssClass;
 
                         args.get_cell().innerHTML = "<span>" + args.get_date()[2] + "</span>";
 
 
                         args.get_cell().DayId = "";
                     } else {
                         var otherMonthCssClass = "CalendarEnabled";
                         args.get_cell().className = otherMonthCssClass;
 
                         args.get_cell().innerHTML = "<span>" + args.get_date()[2] + "</span>";
                     }
                 }
            </script>


Protected Sub Calendar_OnDayRender(ByVal sender As Object, ByVal e As Telerik.Web.UI.Calendar.DayRenderEventArgs)
    Dim specialday As New RadCalendarDay
 
    If e.Day.Date.DayOfWeek = DayOfWeek.Sunday Then
        specialday.Date = e.Day.Date
        specialday.IsSelectable = False
        specialday.ToolTip = "Closed"
        specialday.ItemStyle.CssClass = "CalendarDisabled"
        With rdpDatePicker
            .Calendar.SpecialDays.Add(specialday)
        End With
    ElseIf e.Day.Date.DayOfWeek = DayOfWeek.Saturday Then
        specialday.Date = e.Day.Date
        specialday.IsSelectable = True
        specialday.ItemStyle.CssClass = "CalendarEnabled"
        With rdpDatePicker
            .Calendar.SpecialDays.Add(specialday)
        End With
 
    End If
End Sub

Tsvetina
Telerik team
 answered on 24 Nov 2010
2 answers
60 views
Hi,

Is there a way to trigger a postback from the OnClientNodeExpanding and OnClientNodeCollapsing? The reason is i have 5000 of nodes and had to check for childnodes for every nodes.

Thanks!
jing
Top achievements
Rank 1
 answered on 24 Nov 2010
1 answer
78 views
Hello,

I have a radgrid with different colors for alternating rows (gray and white) and the selected row is yellow. Only one row can be selected at a time.

<AlternatingItemStyle BackColor="GhostWhite" />
<ItemStyle BackColor="LightGray" />
<SelectedItemStyle BackColor="Lightyellow" />

When I select a row its backcolor becomes yellow. When i select another row, the previous selection loses all its color. how do i retain the LightGray and GhostWhite color on deselecting a row.

Thanks!
Shinu
Top achievements
Rank 2
 answered on 24 Nov 2010
4 answers
74 views
Hello,

I have been using TeleGrid Ajax Grid ...

When I drag & drop a column, column header's position is not changed ... but data in the cells in other rows were appropriately moved

Any workaround?

Thank you

Regards
Raj
Rajz
Top achievements
Rank 1
 answered on 24 Nov 2010
1 answer
48 views
hi guys

i 'm facing problem in grid .
i have one column called name that contain like
'*Security: Authentication policy change'
but when i searching starts with   * ,it display all record

please help me.
Tsvetoslav
Telerik team
 answered on 24 Nov 2010
3 answers
69 views

Hello,
I have one ajaxified radgrid which is getting ajaxified through RadAjaxManager.Outside the grid I have two asp buttons.On pageload I am adding ajaxsettings for those buttons.On grid inline edit I am trying to disable those buttons.Those buttons are getting disabled.But I am getting null object exception on clicking the button.If I remove the ajaxsettings from pageload everything works fine but the buttons are not getting disabled.Please suggest me at your earliest...Below are the code in page_load.



 

protected void Page_Load(object sender, EventArgs e)

 

{

 

  RadAjaxMgriPur.AjaxSettings.AddAjaxSetting(RGridImportedData, btnCreateOrder,

null);

 

 

 

  RadAjaxMgriPur.AjaxSettings.AddAjaxSetting(btnCreateOrder, RGridImportedData, RadAjaxLoadingPaneliPur);

 

}


 

 

protected void btnCreateOrder_Click(object sender, EventArgs e)

 

{
     //some operations....
   

 

RGridImportedData.Rebind();

 

}

Thanks in advance.

Manaswinee

Radoslav
Telerik team
 answered on 24 Nov 2010
1 answer
107 views
Hi,

I am using a microsoft ajax tab container to display the tabs. I have six tabs inside that container. In each tab, I have a radgrid. The columns for the radgrid are built dynamically. I am loading the data for all the grids during page load. I have a javascript function to adjust the grid height and width. I included this javascript function in the gridcreated event. So, when the tab loads the grid is firing that javascript. But I am not able to get the mastertableview height. The height is returned as zero. I tried using the page_init event to load the grids but it still has the same problem (the height is returned as zero). Is there something that I am missing?

function AutoSize(sender, args)
{
       var dataHeight = sender.get_masterTableView().get_element().clientHeight;
}
Radoslav
Telerik team
 answered on 24 Nov 2010
1 answer
98 views
I'm working on a website that will eventually be deployed to a production Azure server. On one page I'm using a repeater that binding a record that contains an image stored in a varbinary field. I located an article that provides an example on how to use the RadBinaryImage control iin a repeater:

http://www.telerik.com/help/aspnet-ajax/radbinaryimage.html

At the bottom of the page it states "RadBinaryImage doesn't work in WebFarm / WebGarden scenarios". Does this mean I can't use the RadBinaryImage control on an Azure hosted website?
Veli
Telerik team
 answered on 24 Nov 2010
1 answer
109 views
Hi,


I have a webserive who returns two fileds INCOME & EXPENDITURE as output.

I am trying to plot line chart programitically on page load, which has 2 series (ChartSeriesType.Line), & wanted to bind the output of webservice to both the  series.

series1--->INCOME
series2--->EXPENDITURE

Note: Both series are Line type.
I am able to bind with bar chart but not able to  bind with LINE graph dynamically.

In the Telerik example, they are binding the with hardcoded data.


Thanks in advance,

 
Vladimir Milev
Telerik team
 answered on 24 Nov 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?