Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
288 views
Hi!

I have a Grid with an alternating item style, so every alternating row has an alternating color. The grid gets updated when a button is clicked on the page.

I need all rows with errors to have its back color to be set to red after the button click. I tried to accomplish this in Item Data Bound where I switch the back color to red for an item that is a griddataitem and is an error.

But, if there are 3 rows errored out one after the other, the color applies to only the first and third rows and leaves the middle row as it was. Any suggestions on how I could work through this to achieve what I am working towards?

-rD
Galin
Telerik team
 answered on 18 Aug 2011
2 answers
131 views
Hello,

Really like the RadControls for ASP.NET AJAX Demos and the styling you guys used there.  I'd like to adapt some of the demos for prototypes for demonstrations. 

Would it be too much to ask for the source .psd (Adobe Photoshop) files for the Demos (e.g. in the demos folder, RadControlsExamples, styles11, layout11.png, etc.)

Please let me know.

Kind Regards,
John M.
Monty
Top achievements
Rank 1
 answered on 18 Aug 2011
2 answers
198 views
Hello,

I am trying to create a way to display some pdf document that are location on a remote drive connected to our server. This seems like a difficult problem (and Im pretty new). What I have done so far is 1- Read files from specified folder, 2- Create Tab & Pageview for each pdf file. 3 - Read/Write the file to aspx page adding query sting to request specified pdf, 4- Create RadWindow for each pdf add to pageview. It seems like things are starting to work except that in every tab it displays every pdf instead of just displaying a single pdf per tab.

Ive posted my code here [removed by Admin for containing dev version of the Telerik controls].

Any help would be great, I really only know enough to really break things

~Curt
Curt
Top achievements
Rank 1
 answered on 18 Aug 2011
5 answers
181 views

ms-help://telerik.aspnetajax.radcontrols.2008.Q3/telerik.aspnetajax.radgrid.2008.Q3/grid-extract-old-values-from-item.html

             Above is the help documentation  link of Telerik Client side API .  Below is the sample function to  extract old values in the client side . In the below code the variable args is not assigned any object . Can any one please correct the error .

            I am trying to have a grid for fast dataentry on the client side . I am having fixed  rows of 10  in edit mode using pre render . So all rows are in inline edit mode .  I want to extract old and new values in the client side and control the grid action  .

            Please can you advice me with 100 % client side  on the following skills .

            1) get old and new values  in client side .

            2) how to restrict or enable or disable a cell in grid depending on another cell value .
        
             3) I want to validate the row content and on satisfied condition i want it to go to the next row  or else restrict the user to move forward .

         
              Thanks in advance for your help .
       
function GetFirstEditedItemOldValues()
{
  var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
  
  var oldValues=args.get_tableView().extractOldValuesFromItem(0);
  var oldValuesSB = new Sys.StringBuilder();

  for(var property in oldValues)
  {          
    oldValuesSB.append(String.format("<b>{0}</b> : {1} <br/>", property,oldValues[property]));
  } 
}

Veli
Telerik team
 answered on 18 Aug 2011
3 answers
657 views
Hi Team,

How read the RadTextBox old value and new value on button ClientClick event from JavaScript.

i tried below properties and methods, but all are giving the new values only.
var rtb = $find('radTxtName');
get_value(),  get_displayValue(), _initialValue, get_editValue(), get_textBoxValue().

please suggest me how read the RadTextBox old value which is loaded during page load.
Princy
Top achievements
Rank 2
 answered on 18 Aug 2011
3 answers
204 views
Does anyone have/know of any examples for something similar to this: Telerik Sample For Multiple Resources

Except, with multi-valued resources?  I'm new to entity data sources, and I'm just inheriting a project that has an existing model that works.  But the owner is asking for a new resource type to be added that has a one-to-many relationship for "department(s)".  If this was a standard 3-tier system, I would have no trouble getting this completed.

I've got the database updated to the model I THINK by creating a link table Called "EventDepartments" (Model Layout is attached).  and I have the UI populating with the checkbox list.  But...

  1. There is an Integrity error on insert/update: "The type of the key field 'ID' is expected to be 'System.Int32', but the value provided is actually of type 'System.Object[]'."
  2. I have no idea where to go from here, as I don't know where to look for the issue since the appointment form is auto-generated/handled.



ResourceType:
<telerik:ResourceType KeyField="ID" Name="Departments" AllowMultipleValues="true"
        TextField="Text" ForeignKeyField="DepartmentID"
DataSourceID="EDSDepartments" />

 
Source:
<asp:EntityDataSource runat="server" ID="EDSDepartments" ConnectionString="name=OlympiaEntities"
    DefaultContainerName="OlympiaEntities" EntitySetName="Resources" EnableInsert="True"
    Where="it.ResourceTypeID = 4 && Not it.ParentID Is NULL" EnableUpdate="True">
</asp:EntityDataSource>
Peter
Telerik team
 answered on 18 Aug 2011
0 answers
127 views
When I put a Radgrid inside a regular asp:Menu and hit the Save button, Radgrid shows the number of items in the grid (see RadgridWorks code).

However, when I put a Radgrid inside a ASPxPageControl and hit the Save button, the btnSave_OnClick shows that the row count for the Radgrid is zero (see RadgridFails code).

What I'm trying to do is simply loop through the grid after checking/unchecking checkboxes and committing those values to the db. Incidentally, I get the same behavior with a regular asp:GridView. It works when inside an asp:Menu, but not when inside a ASPxPageControl. Any help is much appreciated!


RadgridWorks.aspx:
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Menu ID="menuScheduleActivityEditor" Width="350px" runat="server" Orientation="Horizontal"
            OnMenuItemClick="menuScheduleActivityEditor_MenuItemClick" StaticEnableDefaultPopOutImage="false"
            Font-Bold="True">
            <Items>
                <asp:MenuItem Text="Checklist" Value="0" Selected="True"></asp:MenuItem>
                <asp:MenuItem Text="Notes" Value="1"></asp:MenuItem>
            </Items>
        </asp:Menu>
        <br />
        <asp:MultiView ID="multiviewScheduleActivityEditor" runat="server" ActiveViewIndex="0">
            <asp:View ID="viewDetails" runat="server">
                <asp:Button ID="btnSave" runat="server" Text="Save Checked Items" OnClick="btnSave_OnClick" />
                <br />
                <radG:RadGrid ID="rgChecklistItems" AllowMultiRowSelection="True" runat="server"
                    AllowSorting="True" GridLines="None">
                    <MasterTableView AutoGenerateColumns="False" DataKeyNames="ScheduleActivityChecklistItemID">
                        <RowIndicatorColumn Visible="False">
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn Visible="False">
                            <HeaderStyle Width="19px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>
                            <radG:GridTemplateColumn HeaderText="Complete" UniqueName="Complete">
                                <ItemTemplate>
                                    <asp:CheckBox ID="chboxComplete" runat="server" Checked='<%# Bind("Complete") %>'
                                        Enabled="true" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:CheckBox ID="chboxComplete" runat="server" Checked='<%# Bind("Complete") %>' />
                                </EditItemTemplate>
                            </radG:GridTemplateColumn>
                            <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistName" HeaderText="Item"
                                DataField="ScheduleActivityChecklistName">
                                <ItemStyle HorizontalAlign="Left" />
                            </radG:GridBoundColumn>
                            <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistID" HeaderText="saCID" DataField="ScheduleActivityChecklistID">
                                <ItemStyle HorizontalAlign="Left" />
                            </radG:GridBoundColumn>
                            <radG:GridBoundColumn UniqueName="ChecklistID" HeaderText="CID" DataField="ChecklistID">
                                <ItemStyle HorizontalAlign="Left" />
                            </radG:GridBoundColumn>
                            <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistItemID" HeaderText="saCIID"
                                DataField="ScheduleActivityChecklistItemID">
                                <ItemStyle HorizontalAlign="Left" />
                            </radG:GridBoundColumn>
                        </Columns>
                        <PagerStyle PagerTextFormat="Pages: {4} &nbsp;|&nbsp; Displaying page {0} of {1}, items {2} to {3} of {5}."
                            Mode="NumericPages" />
                        <GroupHeaderItemStyle BackColor="LightSteelBlue" />
                        <AlternatingItemStyle BackColor="#E0E0E0" />
                        <ItemStyle BackColor="White" />
                    </MasterTableView>
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <HeaderStyle Wrap="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                </radG:RadGrid>
            </asp:View>
            <asp:View ID="viewNotes" runat="server">
                NOTES
            </asp:View>
        </asp:MultiView>
    </div>
    </form>
</body>

RadgridWorks.aspx.cs:
public partial class RadgridWorks : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      DoWork_ActivityDetail();
    }
  }
  
  public void DoWork_ActivityDetail()
  {
    int scheduleActivityID = 707;
    string signature = "41aa56f1-a1c4-40c7-9f8c-97c262fc5a45";
  
    // ---------------------------------------------
    // CHECKLIST TAB
    // ---------------------------------------------
    rgChecklistItems.DataSource = GetScheduleActivityChecklistItems(signature, scheduleActivityID);
    rgChecklistItems.DataBind();
  
    int ab = rgChecklistItems.Items.Count;
  }
  
  protected void btnSave_OnClick(object sender, EventArgs e)
  {
  
    string signature = "41aa56f1-a1c4-40c7-9f8c-97c262fc5a45";
    string portalUserID = "ADMIN";
    int scheduleActivityID = 707;
    bool AutoComplete = false;
  
    int ab = rgChecklistItems.Items.Count;
  
    int bmt_ScheduleActivityChecklistID;
    int bmt_ChecklistID;
    int bmt_ScheduleActivityChecklistItemID;
    string bmt_ChecklistItemComplete = "F";
  
    foreach (GridDataItem x in rgChecklistItems.Items)
    {
      bmt_ScheduleActivityChecklistID = int.Parse(x.Cells[4].Text);
      bmt_ChecklistID = int.Parse(x.Cells[5].Text);
      bmt_ScheduleActivityChecklistItemID = int.Parse(x.Cells[6].Text);
  
      //Get the value of the row's checkbox
      CheckBox chkbox1 = (CheckBox)x.FindControl("chboxComplete");
  
      if (AutoComplete == true)
      {
        bmt_ChecklistItemComplete = "T";
      }
      else
      {
        if (chkbox1.Checked)
        {
          bmt_ChecklistItemComplete = "T";
        }
        else
        {
          bmt_ChecklistItemComplete = "F";
        }
  
        BmtSchedulingService.SchedulingService s = new BmtSchedulingService.SchedulingService();
        BmtSchedulingService.BmtApiResult r = null;
        r = s.UpdateScheduleActivityCheckListItem(signature, scheduleActivityID, bmt_ScheduleActivityChecklistID, bmt_ChecklistID, bmt_ScheduleActivityChecklistItemID, bmt_ChecklistItemComplete, portalUserID);
      }
    }
  
    DoWork_ActivityDetail();
  
  }
  
  public DataView GetScheduleActivityChecklistItems(string signature, int scheduleActivityID)
  {
    BmtSchedulingService.SchedulingService s = new BmtSchedulingService.SchedulingService();
    BmtSchedulingService.ScheduleActivityChecklistItemData[] r = null;
    r = s.GetScheduleActivityChecklistItems(signature, scheduleActivityID);
  
    DataTable dt = new DataTable();
    dt.Columns.Add("ScheduleActivityID", typeof(int));
    dt.Columns.Add("ScheduleActivityChecklistID", typeof(int));
    dt.Columns.Add("ChecklistID", typeof(int));
    dt.Columns.Add("ScheduleActivityChecklistName", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemName", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemID", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemCategory", typeof(string));
    dt.Columns.Add("Complete", typeof(bool));
    dt.Columns.Add("DateCompleted", typeof(string));
    dt.Columns.Add("UserCompleted", typeof(string));
  
    DataRow oDataRow;
    for (int i = 0; i < r.Length; i++)
    {
      oDataRow = dt.NewRow();
      oDataRow["ScheduleActivityID"] = r[i].ScheduleActivityID.ToString();
      oDataRow["ScheduleActivityChecklistID"] = r[i].ScheduleActivityChecklistID.ToString();
      oDataRow["ChecklistID"] = r[i].ChecklistID.ToString();
      oDataRow["ScheduleActivityChecklistName"] = r[i].ScheduleActivityChecklistName.ToString();
      oDataRow["ScheduleActivityChecklistItemName"] = r[i].ScheduleActivityChecklistItemName.ToString();
      oDataRow["ScheduleActivityChecklistItemID"] = r[i].ScheduleActivityChecklistItemID.ToString();
      oDataRow["ScheduleActivityChecklistItemCategory"] = r[i].ScheduleActivityChecklistItemCategory.ToString();
      oDataRow["Complete"] = r[i].Complete.ToString();
      oDataRow["DateCompleted"] = r[i].DateCompleted.ToString();
      oDataRow["UserCompleted"] = r[i].UserCompleted.ToString();
      dt.Rows.Add(oDataRow);
    }
  
    return dt.DefaultView;
  }
  
  protected void menuScheduleActivityEditor_MenuItemClick(object sender, MenuEventArgs e)
  {
    multiviewScheduleActivityEditor.ActiveViewIndex = Int32.Parse(e.Item.Value);
  
    int i;
  
    for (i = 0; i <= menuScheduleActivityEditor.Items.Count - 1; i++)
    {
      if (i.ToString() == e.Item.Value)
      {
        menuScheduleActivityEditor.Items[i].Enabled = false;
  
      }
      else
      {
        menuScheduleActivityEditor.Items[i].Enabled = true;
      }
    }
  }
  
  
}

RadgridFails.aspx:
<body>
    <form id="form1" runat="server">
    <div>
        <dxtc:ASPxPageControl ID="pcActivityDetail" runat="server" ActiveTabIndex="0" CssFilePath="~/App_Themes/Aqua/{0}/styles.css"
            CssPostfix="Aqua" Height="297px" ImageFolder="~/App_Themes/Aqua/{0}/" LoadingPanelText=""
            TabSpacing="3px" Width="826px" EnableViewState="False">
            <ContentStyle>
                <Border BorderColor="#AECAF0" BorderStyle="Solid" BorderWidth="1px"></Border>
            </ContentStyle>
            <Paddings Padding="2px" PaddingLeft="5px" PaddingRight="5px"></Paddings>
            <TabPages>
                <dxtc:TabPage Name="tabChecklist" Text="Checklist">
                    <ContentCollection>
                        <dxw:ContentControl ID="ContentControlChecklist" runat="server">
                            <asp:Button ID="btnSave" runat="server" Text="Save Checked Items" OnClick="btnSave_OnClick" />
                            <br />
                            <br />
                            <radG:RadGrid ID="rgChecklistItems" AllowMultiRowSelection="True" runat="server"
                                AllowSorting="True" GridLines="None">
                                <MasterTableView AutoGenerateColumns="False" DataKeyNames="ScheduleActivityChecklistItemID">
                                    <RowIndicatorColumn Visible="False">
                                        <HeaderStyle Width="20px"></HeaderStyle>
                                    </RowIndicatorColumn>
                                    <ExpandCollapseColumn Visible="False">
                                        <HeaderStyle Width="19px"></HeaderStyle>
                                    </ExpandCollapseColumn>
                                    <Columns>
                                        <radG:GridTemplateColumn HeaderText="Complete" UniqueName="Complete">
                                            <ItemTemplate>
                                                <asp:CheckBox ID="chboxComplete" runat="server" Checked='<%# Bind("Complete") %>'
                                                    Enabled="true" />
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <asp:CheckBox ID="chboxComplete" runat="server" Checked='<%# Bind("Complete") %>' />
                                            </EditItemTemplate>
                                        </radG:GridTemplateColumn>
                                        <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistName" HeaderText="Item"
                                            DataField="ScheduleActivityChecklistName">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </radG:GridBoundColumn>
                                        <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistID" HeaderText="saCID"
                                            DataField="ScheduleActivityChecklistID">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </radG:GridBoundColumn>
                                        <radG:GridBoundColumn UniqueName="ChecklistID" HeaderText="CID" DataField="ChecklistID">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </radG:GridBoundColumn>
                                        <radG:GridBoundColumn UniqueName="ScheduleActivityChecklistItemID" HeaderText="saCIID"
                                            DataField="ScheduleActivityChecklistItemID">
                                            <ItemStyle HorizontalAlign="Left" />
                                        </radG:GridBoundColumn>
                                    </Columns>
                                    <PagerStyle PagerTextFormat="Pages: {4} &nbsp;|&nbsp; Displaying page {0} of {1}, items {2} to {3} of {5}."
                                        Mode="NumericPages" />
                                    <GroupHeaderItemStyle BackColor="LightSteelBlue" />
                                    <AlternatingItemStyle BackColor="#E0E0E0" />
                                    <ItemStyle BackColor="White" />
                                </MasterTableView>
                                <ClientSettings>
                                    <Selecting AllowRowSelect="True" />
                                </ClientSettings>
                                <HeaderStyle Wrap="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            </radG:RadGrid>
                        </dxw:ContentControl>
                    </ContentCollection>
                </dxtc:TabPage>
                <dxtc:TabPage Name="tabNotes" Text="Notes">
                    <ContentCollection>
                        <dxw:ContentControl ID="ContentControlNotes" runat="server">
                            NOTES
                        </dxw:ContentControl>
                    </ContentCollection>
                </dxtc:TabPage>
            </TabPages>
        </dxtc:ASPxPageControl>
    </div>
    </form>
</body>

RadgridFails.aspx.cs:
public partial class RadgridFails : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!IsPostBack)
    {
      DoWork_ActivityDetail();
    }
  }
  
  public void DoWork_ActivityDetail()
  {
    int scheduleActivityID = 707;
    string signature = "41aa56f1-a1c4-40c7-9f8c-97c262fc5a45";
  
    // ---------------------------------------------
    // CHECKLIST TAB
    // ---------------------------------------------
    rgChecklistItems.DataSource = GetScheduleActivityChecklistItems(signature, scheduleActivityID);
    rgChecklistItems.DataBind();
  
    // THIS RETURNS THE NUMBER OF ITEMS AND WORKS FINE !!!
    int ab = rgChecklistItems.Items.Count; 
  }
  
  protected void btnSave_OnClick(object sender, EventArgs e)
  {
  
    string signature = "41aa56f1-a1c4-40c7-9f8c-97c262fc5a45";
    string portalUserID = "ADMIN";
    int scheduleActivityID = 707;
    bool AutoComplete = false;
  
    // AT THIS POINT, NUMBER OF ITEMS = 0 EVEN THOUGH THE GRID SHOWED ITEMS WHEN LOADING !!!!!
    int ab = rgChecklistItems.Items.Count;
  
    int bmt_ScheduleActivityChecklistID;
    int bmt_ChecklistID;
    int bmt_ScheduleActivityChecklistItemID;
    string bmt_ChecklistItemComplete = "F";
  
    foreach (GridDataItem x in rgChecklistItems.Items)
    {
      bmt_ScheduleActivityChecklistID = int.Parse(x.Cells[4].Text);
      bmt_ChecklistID = int.Parse(x.Cells[5].Text);
      bmt_ScheduleActivityChecklistItemID = int.Parse(x.Cells[6].Text);
  
      //Get the value of the row's checkbox
      CheckBox chkbox1 = (CheckBox)x.FindControl("chboxComplete");
  
      if (AutoComplete == true)
      {
        bmt_ChecklistItemComplete = "T";
      }
      else
      {
        if (chkbox1.Checked)
        {
          bmt_ChecklistItemComplete = "T";
        }
        else
        {
          bmt_ChecklistItemComplete = "F";
        }
  
        BmtSchedulingService.SchedulingService s = new BmtSchedulingService.SchedulingService();
        BmtSchedulingService.BmtApiResult r = null;
        r = s.UpdateScheduleActivityCheckListItem(signature, scheduleActivityID, bmt_ScheduleActivityChecklistID, bmt_ChecklistID, bmt_ScheduleActivityChecklistItemID, bmt_ChecklistItemComplete, portalUserID);
      }
    }
  
    DoWork_ActivityDetail();
  
  }
  
  public DataView GetScheduleActivityChecklistItems(string signature, int scheduleActivityID)
  {
    BmtSchedulingService.SchedulingService s = new BmtSchedulingService.SchedulingService();
    BmtSchedulingService.ScheduleActivityChecklistItemData[] r = null;
    r = s.GetScheduleActivityChecklistItems(signature, scheduleActivityID);
  
    DataTable dt = new DataTable();
    dt.Columns.Add("ScheduleActivityID", typeof(int));
    dt.Columns.Add("ScheduleActivityChecklistID", typeof(int));
    dt.Columns.Add("ChecklistID", typeof(int));
    dt.Columns.Add("ScheduleActivityChecklistName", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemName", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemID", typeof(string));
    dt.Columns.Add("ScheduleActivityChecklistItemCategory", typeof(string));
    dt.Columns.Add("Complete", typeof(bool));
    dt.Columns.Add("DateCompleted", typeof(string));
    dt.Columns.Add("UserCompleted", typeof(string));
  
    DataRow oDataRow;
    for (int i = 0; i < r.Length; i++)
    {
      oDataRow = dt.NewRow();
      oDataRow["ScheduleActivityID"] = r[i].ScheduleActivityID.ToString();
      oDataRow["ScheduleActivityChecklistID"] = r[i].ScheduleActivityChecklistID.ToString();
      oDataRow["ChecklistID"] = r[i].ChecklistID.ToString();
      oDataRow["ScheduleActivityChecklistName"] = r[i].ScheduleActivityChecklistName.ToString();
      oDataRow["ScheduleActivityChecklistItemName"] = r[i].ScheduleActivityChecklistItemName.ToString();
      oDataRow["ScheduleActivityChecklistItemID"] = r[i].ScheduleActivityChecklistItemID.ToString();
      oDataRow["ScheduleActivityChecklistItemCategory"] = r[i].ScheduleActivityChecklistItemCategory.ToString();
      oDataRow["Complete"] = r[i].Complete.ToString();
      oDataRow["DateCompleted"] = r[i].DateCompleted.ToString();
      oDataRow["UserCompleted"] = r[i].UserCompleted.ToString();
      dt.Rows.Add(oDataRow);
    }
  
    return dt.DefaultView;
  }
  
  
}

RRH
Top achievements
Rank 1
 asked on 18 Aug 2011
6 answers
682 views
I have a radiobuttonlist which is a trigger for three other controls. The issue I am having is that the OnSelectedIndexChanged event is not firing the second time around. This means that the rest of the controls encompassed by the trigger doesn't update.

I need help determing why the three controls are not being updated by Ajax the second time around. Notice the boldfaced items which are the key to getting this to work.

If I remove the AJAX manager, the controls get updated successfully the second time around, but you can see the postback occurring in the browser which I ultimately don't want to see. 

Here is my html:
<code>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="rblDataType">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="lstPatientEDLogs" />
                <telerik:AjaxUpdatedControl ControlID="pnlNoPatientInfoCounts" />
                <telerik:AjaxUpdatedControl ControlID="pnlPatientInfoCounts" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
</code>

<code>
<asp:Panel ID="pnlData" runat="server" GroupingText="Data Type for DOS" Width="1100px">
                    <asp:RadioButtonList ID="rblDataType" RepeatDirection="Horizontal" TextAlign="Right"
                        runat="server" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="rblDataType_SelectedIndexChanged">
                        <asp:ListItem Text="No Patient Info" Selected="True"></asp:ListItem>
                        <asp:ListItem Text="Patient Info"></asp:ListItem>
                        <asp:ListItem Text="Visit Info" Enabled="false"></asp:ListItem>
                    </asp:RadioButtonList>
                </asp:Panel>
</code>

<code>
<asp:Panel ID="pnlNoPatientInfoCounts" runat="server" GroupingText="No Patient Info Count"
                    Width="1100px">
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblDataNETCnt1" runat="server" Text="DataNET: "></asp:Label>
                                <asp:Label ID="lblDataNETCntData1" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblDataNET_PendingCnt1" runat="server" Text="DataNET/Pending: "></asp:Label>
                                <asp:Label ID="lblDataNET_PendingCntData1" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblDataNET_DeficientCnt1" runat="server" Text="DataNET/Deficient: "></asp:Label>
                                <asp:Label ID="lblDataNET_DeficientCntData1" runat="server" Text="0"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
</code>

</code>
<asp:Panel ID="pnlPatientInfoCounts" runat="server" GroupingText="Patient Info Count"
                    Width="1100px">
                    <table>
                        <tr>
                            <td>
                                <asp:Label ID="lblDataNET_PendingCnt2" runat="server" Text="DataNET/Pending: "></asp:Label>
                                <asp:Label ID="lblDataNET_PendingCntData2" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblDataNET_DeficientCnt2" runat="server" Text="DataNET/Deficient: "></asp:Label>
                                <asp:Label ID="lblDataNET_DeficientCntData2" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblCodeNETCnt2" runat="server" Text="CodeNET: "></asp:Label>
                                <asp:Label ID="lblCodeNETCntData2" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblCodeNET_PendingCnt2" runat="server" Text="CodeNET/Pending: "></asp:Label>
                                <asp:Label ID="lblCodeNET_PendingCntData2" runat="server" Text="0"></asp:Label>
                            </td>
                            <td>
                                <asp:Label ID="lblCodeNET_DeficientCnt2" runat="server" Text="CodeNET/Deficient: "></asp:Label>
                                <asp:Label ID="lblCodeNET_DeficientCntData2" runat="server" Text="0"></asp:Label>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
</code>

Here is my server side code-behind: This is the code that changes the other three controls. However, when the index is changed for the radiobuttonlist, the second time around, a postback is never fired. It gets hit the first time I change the index of the radiobuttonlist, but not the second time.
<code>
protected void rblDataType_SelectedIndexChanged(Object sender, EventArgs e)
        {
            LoadDatesofSvc();
        }
</code>
Tsvetina
Telerik team
 answered on 18 Aug 2011
2 answers
62 views
I have a ASPX page with Rad grid , this grid loaded with data.

 

when a row is selected and clicked on a radTolBarButton,to edit its content . Actually it opens a Rad window (window.radopen) with all the controls in editable mode.

 

we can edit ,save and also close this window ( provided a Rad button 'Close' in a Rad tool bar )

 

My Requirement is below.

 

on edit - save - close button click

 

1.Need to close the window - (this is happening)

 

2.Need to refresh the content in the grid - from - where this rad window opend. (this is not happening)

 

 

I dont want to change Content edit procedure. This is already finalised.

 

The only thing is to refresh the grid content on Rad window close.


Please help me.

Thanks in advance

Dilip
Top achievements
Rank 1
 answered on 18 Aug 2011
2 answers
237 views
I am able to update and delete the rows from RadGrid but It gives me following exception on insert :-
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Cannot insert the value NULL into column 'Alert_Level_ID', table 'AlertEmailManagement.dbo.Alert_Level'; column does not allow nulls. INSERT fails.
The statement has been terminated.
The problem is it does insert the row in Database and I am sure that alert_level_id is not null.
eher is my code:-
<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/ITIMaster.Master" CodeBehind="AlertLevelAdmin.aspx.vb" Inherits="EmailAlertsMonitor.AlertLevelAdmin" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <telerik:RadGrid ID="gvAlertLevels" runat="server" AutoGenerateColumns="False" 
        CellSpacing="0" DataSourceID="SqlDataSource1" GridLines="None" 
        Skin="Outlook" AllowAutomaticDeletes ="true" AllowAutomaticUpdates ="true" AllowAutomaticInserts="true" >
<MasterTableView DataSourceID="SqlDataSource1" DataKeyNames ="Alert_Level_ID" CommandItemDisplay ="TopAndBottom"  >
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
  
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
  
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
  
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
<Columns >
     <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                        <ItemStyle CssClass="MyImageButton" />
                    </telerik:GridEditCommandColumn>
     <telerik:GridButtonColumn ConfirmText="Are you sure you want to delete this alert?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                        UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" />
                    </telerik:GridButtonColumn>
  
    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" 
        UniqueName="TemplateColumn" HeaderText ="Alert Level ID">
          <ItemTemplate >
                <asp:Label ID="lblAlertLevelID" runat ="server" Text ='<%#EVAL("Alert_Level_ID") %>'></asp:Label>
          </ItemTemplate>
          <EditItemTemplate >
                <asp:TextBox ID="txtAlertLevelID" runat ="server" Text ='<%#EVAL("Alert_Level_ID") %>'></asp:TextBox>
                <asp:CompareValidator ID="cvAlertLevelID" runat ="server" ControlToValidate ="txtAlertLevelID" Operator ="DataTypeCheck" Type ="Integer" SetFocusOnError ="true" ErrorMessage ="Alert Level ID must be numeric." ForeColor ="Red" ValidationGroup ="editData" ></asp:CompareValidator>
          </EditItemTemplate>
     </telerik:GridTemplateColumn>
     <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" 
        UniqueName="TemplateColumn" HeaderText ="Alert Level Description">
          <ItemTemplate >
                <asp:Label ID="lblAlertLevel" runat ="server" Text ='<%#EVAL("Alert_Level") %>'></asp:Label>
          </ItemTemplate>
          <EditItemTemplate >
                <asp:TextBox ID="txtAlertLevel" runat ="server" Text ='<%#EVAL("Alert_Level") %>'></asp:TextBox>
                <asp:RequiredFieldValidator ID="rvAlertLevel" runat ="server" ControlToValidate="txtAlertLevel" SetFocusOnError ="true" ErrorMessage ="Must enter Alert Level Description." ForeColor ="Red" ValidationGroup ="editData"></asp:RequiredFieldValidator>
          </EditItemTemplate>
     </telerik:GridTemplateColumn>
    <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" 
        UniqueName="TemplateColumn3" HeaderText ="Alert Level Color Code">
         <ItemTemplate >
                <asp:Label ID="lblAlertLevelColor" runat ="server" Text ='<%#EVAL("Alert_Level_Color_Code") %>'></asp:Label>
                 
          </ItemTemplate>
          <EditItemTemplate >
                  <telerik:RadColorPicker ID="RadColorPicker1" runat="server" ShowIcon="true" OnColorChanged ="RadColorPicker1_ColorChanged" Width ="250px" Height ="400px" >
                  </telerik:RadColorPicker>
          </EditItemTemplate>
            
    </telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
  
<FilterMenu EnableImageSprites="False"></FilterMenu>
  
<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>
    </telerik:RadGrid>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                       ConnectionString="<%$ ConnectionStrings:DBConnectionString %>" 
                       SelectCommand="SELECT * FROM [Alert_Level]" 
                       InsertCommand ="INSERT INTO [Alert_Level] VALUES(@alertLevelID,@alertLevel,@alertColorCode)"
                       UpdateCommand ="UPDATE [Alert_Level] SET alert_level=@alertLevel,alert_level_color_code=@alertColorCode WHERE alert_Level_ID=@alertLevelID" 
                       DeleteCommand ="DELETE FROM [Alert_Level] WHERE alert_Level_ID=@alertLevelID" >
     <InsertParameters >
       <asp:Parameter Name ="AlertLevelID" Type ="Int16" />
       <asp:Parameter Name ="AlertLevel" Type ="String" />
       <asp:Parameter Name ="AlertColorCode" Type ="String" />
     </InsertParameters>                  
     <UpdateParameters >
       <asp:Parameter Name ="AlertLevelID" Type ="Int16" />
       <asp:Parameter Name ="AlertLevel" Type ="String" />
       <asp:Parameter Name ="AlertColorCode" Type ="String" />
     </UpdateParameters>                 
     <DeleteParameters >
       <asp:Parameter Name ="AlertLevelID" Type ="Int16" />
     </DeleteParameters>                  
                         
</asp:SqlDataSource>
</asp:Content>
Imports Telerik.Web.UI
Imports System.Drawing
Public Class AlertLevelAdmin
    Inherits System.Web.UI.Page
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
    End Sub
  
    Public Sub RadColorPicker1_ColorChanged(ByVal sender As Object, ByVal e As EventArgs)
        Dim RadColorPicker1 As RadColorPicker = CType(sender, RadColorPicker)
        Dim gvItem As GridItem = DirectCast(RadColorPicker1.NamingContainer, GridItem)
        gvItem.BackColor = RadColorPicker1.SelectedColor
    End Sub
  
    Private Sub gvAlertLevels_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles gvAlertLevels.ItemDataBound
        If TypeOf e.Item Is GridDataItem Then
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            item("TemplateColumn3").BackColor = ColorTranslator.FromHtml((DataBinder.Eval(e.Item.DataItem, ("Alert_Level_Color_Code").ToString)))
        End If
  
        Dim radColorPicker1 As RadColorPicker = DirectCast(e.Item.FindControl("RadColorPicker1"), RadColorPicker)
        If Not IsNothing(radColorPicker1) Then
            If Not IsDBNull(DataBinder.Eval(e.Item.DataItem, ("Alert_Level_Color_Code"))) Then
                radColorPicker1.SelectedColor = ColorTranslator.FromHtml((DataBinder.Eval(e.Item.DataItem, ("Alert_Level_Color_Code").ToString)))
            End If
        End If
  
  
    End Sub
  
    Private Sub gvAlertLevels_ItemDeleted(sender As Object, e As Telerik.Web.UI.GridDeletedEventArgs) Handles gvAlertLevels.ItemDeleted
        Try
            Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim alertLevelID As Integer = CInt(item.GetDataKeyValue("Alert_Level_ID").ToString)
            SqlDataSource1.DeleteParameters("AlertLevelID").DefaultValue = alertLevelID
            SqlDataSource1.Delete()
        Catch ex As Exception
  
        End Try
    End Sub
  
    Private Sub gvAlertLevels_ItemInserted(sender As Object, e As Telerik.Web.UI.GridInsertedEventArgs) Handles gvAlertLevels.ItemInserted
        Try
            Dim alertLevelID As Integer = DirectCast(e.Item.FindControl("txtAlertLevelID"), TextBox).Text
            Dim alertLevel As String = DirectCast(e.Item.FindControl("txtAlertLevel"), TextBox).Text
            Dim alertColorCode As String = ColorTranslator.ToHtml(DirectCast(e.Item.FindControl("RadColorPicker1"), RadColorPicker).SelectedColor)
            SqlDataSource1.InsertParameters("AlertLevelID").DefaultValue = alertLevelID
            SqlDataSource1.InsertParameters("AlertLevel").DefaultValue = alertLevel.ToUpper
            SqlDataSource1.InsertParameters("AlertColorCode").DefaultValue = alertColorCode
            SqlDataSource1.Insert()
        Catch ex As Exception
  
        End Try
    End Sub
  
    Private Sub gvAlertLevels_ItemUpdated(sender As Object, e As Telerik.Web.UI.GridUpdatedEventArgs) Handles gvAlertLevels.ItemUpdated
        Try
            Dim item As GridEditFormItem = DirectCast(e.Item, GridEditFormItem)
            Dim alertLevelID As Integer = CInt(item.GetDataKeyValue("Alert_Level_ID").ToString)
            Dim alertLevel As String = DirectCast(item.FindControl("txtAlertLevel"), TextBox).Text
            Dim alertColorCode As String = ColorTranslator.ToHtml(DirectCast(item.FindControl("RadColorPicker1"), RadColorPicker).SelectedColor)
            SqlDataSource1.UpdateParameters("AlertLevelID").DefaultValue = alertLevelID
            SqlDataSource1.UpdateParameters("AlertLevel").DefaultValue = alertLevel.ToUpper
            SqlDataSource1.UpdateParameters("AlertColorCode").DefaultValue = alertColorCode
            SqlDataSource1.Update()
        Catch ex As Exception
  
        End Try
    End Sub
End Class
Sonia
Top achievements
Rank 1
 answered on 18 Aug 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?