Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
150 views
  Hey,



My issue is with ListView, I have the insert function working in the Telerik radlistview, but the delete and update it is not working because I need to get the homeworkID from each list. I do not know how to get the homeworkID or selectedindex. if you guys can help me on this...I woudl be so much appreciate it. I have the URL link where you can download the source code: http://www.mediafire.com/download.php?xj3ll2qjajglyrf.

For people who do not want to download the source code and want to it see it here I have pasted the code in here as well:

<%@ Page Title="" Language="VB" MasterPageFile="~/Admin.master" AutoEventWireup="false" CodeFile="EditAssignHomework.aspx.vb" Inherits="EditAssignHomework" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
 
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:ScriptManager runat="server" ID="scriptmanager1"></asp:ScriptManager>
     <telerik:RadFormDecorator runat="server" ID="QsfFromDecorator" DecoratedControls="All" EnableRoundedCorners="true" />
              <div>
                  <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="ListViewPanel1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadListView1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lblhomeworkID" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="RadListView1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                    <telerik:AjaxSetting AjaxControlID="RadListView2">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="lblhomeworkID" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="RadListView2" LoadingPanelID="RadAjaxLoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="CheckBoxList1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="CheckBoxList1"></telerik:AjaxUpdatedControl>
                        <telerik:AjaxUpdatedControl ControlID="ListViewPanel1" LoadingPanelID="RadAjaxLoadingPanel1">
                        </telerik:AjaxUpdatedControl>
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
            <ClientEvents OnRequestStart="RequestStart"></ClientEvents>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function RequestStart(sender, eventArgs) {
                    //disable ajax on update/insert operation to upload the image
                    if ((eventArgs.get_eventTarget().indexOf("Update") > -1) || (eventArgs.get_eventTarget().indexOf("PerformInsert") > -1)) {
                        eventArgs.set_enableAjax(false);
                    }
                }
            </script>
        </telerik:RadCodeBlock>
         
              </div>
  
     <table id="Table1" runat="server" width="600px" >
        <tr>
           <td>
              <asp:Label ID="Label1" runat="server" Text="List of available students:"></asp:Label>
           </td>
           <td>
                <telerik:RadDropDownList runat="server" ID="lstStudentNames"  AutoPostBack="true" DefaultMessage="Select a record" DataValueField="UserID" DataTextField="FullName" DataSourceID="SqlDataSource1" OnItemDataBound="lstStudentNames_ItemDataBound" OnItemSelected="lstStudentNames_ItemSelected" OnSelectedIndexChanged="lstStudentNames_SelectedIndexChanged" Width="300px"></telerik:RadDropDownList>
           </td>
           </tr>
  
 
        <tr>
           <td>
              
               <table>
                  <tr>
                     <td>
                        <h3>Assignment(s) for student(s) configuration panel</h3>
                        <asp:Panel runat="server" ID="ListViewPanel1">
                            <telerik:RadListView ID="RadListView1" DataSourceID="SqlDataSource2" runat="server" OnSelectedIndexChanged="RadListView1_SelectedIndexChanged" ItemPlaceholderID="AssignmentsContainer" DataKeyNames="UserID" AllowPaging="true" OnItemCommand="RadListView1_ItemCommand">
                                <LayoutTemplate>
                                    <fieldset id="FieldSet1" style="max-width: 946px;">
                                    <legend>Homeworks</legend>
                                    <table cellpadding="0" cellspacing="0" width="100%">
                                        <tr>
                                            <td>                                           
                                                <telerik:RadDataPager runat="server" id="RadDataPager1" PageControlID="RadListView1" PageSize="2" CssClass="paperStyle">
                                                    <Fields>
                                                       <telerik:RadDataPagerButtonField FieldType="FirstPrev" />
                                                       <telerik:RadDataPagerButtonField FieldType="Numeric" />
                                                       <telerik:RadDataPagerButtonField FieldType="NextLast" />
                                                       <telerik:RadDataPagerPageSizeField PageSizeComboWidth="60" PageSizeText="Page size:" />
                                                       <telerik:RadDataPagerGoToPageField CurrentPageText="Page:" TotalPageText="of" SubmitButtonText="Go" TextBoxWidth="25" />
                                                       <telerik:RadDataPagerTemplatePageField Visible="true">
                                                            <PagerTemplate>
                                                                <div style="float: right; padding-left: 50px;">
                                                                    <strong>
                                                                        <asp:Label runat="server" ID="lblCurrentPageLabel" Text='<%# IIF(Container.Owner.TotalRowCount > 0, Container.Owner.StartRowIndex + 1, 0) %>'></asp:Label>
                                                                        to <asp:Label runat="server" ID="lblTotalPagesLabel" Text='<%# IIF(Container.Owner.TotalRowCount >0, Container.Owner.StartRowIndex + Container.Owner.PageSize, 0) %>'></asp:Label> of
                                                                     <asp:Label runat="server" ID="lblTotalItemsLabel" Text='<%# Container.Owner.TotalRowCount  %>'></asp:Label>
                                                                    </strong>
                                                                </div>
                                                            </PagerTemplate>
                                                       </telerik:RadDataPagerTemplatePageField>
                                                    </Fields>
                                                </telerik:RadDataPager>
                                            </td>
                                        </tr>
                                    </table>
                                    <asp:PlaceHolder runat="server" ID="AssignmentsContainer"> </asp:PlaceHolder>
                                        <div style="clear:both"> </div>
                                            <table runat="server" style="width:100%; margin-top:5px">
                                                <tr>
                                                    <td style="width: 25%;">
                                                      <telerik:RadButton runat="server" ID="btnInitInsert" OnClick="btnInitInsert_Click" Text="New Assignment"></telerik:RadButton>
                                                    </td>
                                                    <td style="text-align: right; width: 75%;">
                                                        <asp:Label runat="server" ID="lblSort1" Text="Sorty by:" AssociatedControlID="ddListSort" Style="padding-right: 5px;" ></asp:Label>
                                                        <telerik:RadComboBox runat="server" ID="ddListSort" AutoPostBack="true" OnSelectedIndexChanged="ddListSort_SelectedIndexChanged">
                                                            <Items>
                                                                <telerik:RadComboBoxItem Text="-Select field to sort-" Value="" />
                                                                <telerik:RadComboBoxItem Text="Assignment Title" Value="AssignmentName" />
                                                                <telerik:RadComboBoxItem Text="Assighment Description" Value="AssignmentDesc" />
                                                                <telerik:RadComboBoxItem Text="DateAssigned" Value="DateAssigned" />
                                                                <telerik:RadComboBoxItem Text="DateToBeCompleted" Value="DateToBeCompleted" />
                                                                <telerik:RadComboBoxItem Text="DateCompleted" Value="DateCompleted" />
                                                            </Items>
                                                        </telerik:RadComboBox>
                                                        <asp:RadioButtonList RepeatLayout="Flow" runat="server" RepeatDirection="Horizontal" ID="rblSort" OnSelectedIndexChanged="rblSort_SelectedIndexChanged">
                                                            <asp:ListItem Text="Ascending" Value="ASC" Selected="True"></asp:ListItem>
                                                            <asp:ListItem Text="Descending" Value="DESC"></asp:ListItem>
                                                        </asp:RadioButtonList>
                                                    </td>
                                                </tr>
                                            </table>
                                       </fieldset>                                 
                                </LayoutTemplate>
                                <ItemTemplate>
                                    <fieldset class="fieldset">
                                        <legend>Student Name: <asp:Label runat="server" ID="idLegendStudentName"></asp:Label> </legend>
                                        <table cellpadding="0" cellspacing="0" style="height: 100%;" width="100%">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" style="width: 95%;">
                                                        <tr>
                                                            <td>
                                                                <table cellpadding="0" cellspacing="0">
                                                                    
                                                                    <tr>
                                                                        <td style="width: 50%">
                                                                           Assignment Name:
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <%#Eval("AssignmentName")%>
                                                                        </td>
                                                                    </tr>
                                                                     <tr>
                                                                        <td style="width: 50%">
                                                                           Assignment Desc:
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <%#Eval("AssignmentDesc")%>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50%">
                                                                           Date Assigned
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <%#Eval("DateAssigned")%>
                                                                        </td>
                                                                    </tr>
                                                                     <tr>
                                                                        <td style="width: 50%">
                                                                           DateToBeCompleted
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <%#Eval("DateToBeCompleted")%>
                                                                        </td>
                                                                    </tr>
                                                                        <tr>
                                                                        <td style="width: 50%">
                                                                           DateCompleted
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <%#Eval("DateCompleted")%>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50%">
                                                                           Assignment Completed?
                                                                        </td>
                                                                       <td style="width: 50%">
                                                                            <asp:RadioButton runat="server" ID="rdIncompleted" GroupName="AssignmentCompleted" Checked="false" Text="Assignment Incomplete"  />
                                                                            <asp:RadioButton runat="server" ID="rdCompleted" GroupName="AssignmentCompleted" Checked="false" Text="Assignment Completed" />
                                                                            <asp:RadioButton runat="server" ID="rdNotDecided" GroupName="AssignmentCompleted"  Text="Not Decided Yet" Checked="true" />
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table style="width: 95%; margin-top: 30px">
                                                        <tr>
                                                            <td>
                                                                <telerik:RadButton runat="server" ID="btnEdit" CommandName="Edit" Width="70px" Text="Edit"></telerik:RadButton>
                                                            </td>
                                                            <td style="text-align: right">
                                                                <telerik:RadButton runat="server" ID="btnDelete" CommandName="Delete" Width="70px" Text="Delete"></telerik:RadButton>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </fieldset>
                                </ItemTemplate>
                                <EditItemTemplate>
                                  <fieldset class="fieldset">
                                    <table runat="server" cellpadding="0" cellspacing="0" width="100%" style="height: 80%;" >
                                        <tr>
                                            <td>
                                                <table runat="server" cellpadding="0" cellspacing="0" style="width: 95%; margin-bottom: 5px">
                                                    <tr>
                                                        <td>
                                                            <table runat="server" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td style="width: 50%">
                                                                        Assignment Name:
                                                                    </td>
                                                                    <td style="width: 75%">
                                                                        <asp:TextBox runat="server" ID="txtAssignmentName" Text='<%# Bind("AssignmentName") %>'></asp:TextBox>
                                                                        <asp:RequiredFieldValidator runat="server" ID="rqAssignmentName"  ControlToValidate="txtAssignmentName" ErrorMessage="You need to enter assignment name." Display="Dynamic"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="width: 50%">
                                                                        Assignment Desc:
                                                                    </td>
                                                                    <td style="width: 75%">
                                                                        <asp:TextBox runat="server" ID="txtAssignmentDesc" Text='<%# Bind("AssignmentDesc") %>'></asp:TextBox>
                                                                        <asp:RequiredFieldValidator runat="server" ID="rqAssignmentDesc" ControlToValidate="txtAssignmentDesc" ErrorMessage="You need to enter assignment description." Display="Dynamic"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                                 <tr>
                                                                    <td style="width: 50%">
                                                                        Date Assigned:
                                                                    </td>
                                                                    <td style="width: 75%">
                                                                        <asp:TextBox runat="server" id="rdpDateAssigned" Text = '<%# Bind("DateAssigned") %>'> </asp:TextBox>                                                                  
                                                                        <asp:RequiredFieldValidator runat="server" ID="rqDateAssigned" ControlToValidate="rdpDateAssigned" ErrorMessage="You need to enter assigned date." Display="Dynamic"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                                 <tr>
                                                                    <td style="width: 50%">
                                                                        Date To Be Completed:
                                                                    </td>
                                                                    <td style="width: 75%">
                                                                        <asp:TextBox runat="server" id="txtDateToBeCompleted" Text = '<%# Bind("DateToBeCompleted") %>'> </asp:TextBox>                                                                  
                                                                        <asp:RequiredFieldValidator runat="server" ID="rqDateToBeCompleted" ControlToValidate="txtDateToBeCompleted" ErrorMessage="You need to enter date to be completed." Display="Dynamic"></asp:RequiredFieldValidator>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="width: 50%">
                                                                        Date Completed:
                                                                    </td>
                                                                    <td style="width: 75%">
                                                                        <asp:TextBox runat="server" id="txtDateCompleted" Text = '<%# Bind("DateCompleted") %>'> </asp:TextBox>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td colspan="2">
                                                                        <div style="float:left; padding-left: 30%">
                                                                            <asp:Button runat="server" ID="btnUpdate" Text="Update" CommandName="Update" />
                                                                            <asp:Button runat="server" ID="btnCancel" Text="Cancel" CommandName="Cancel" CausesValidation="false" />
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                </table>
                                                    </td>
                                        </tr>
                                    </table>
                                               </fieldset>
                                         
                                 
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <fieldset class="fieldset" style="clear: left; width: 540px">
                                        <table cellpadding="0" cellspacing="0" style="height: 80%;" width="100%">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" style="width: 95%; margin-bottom: 5px">
                                                        <tr>
                                                            <td  style="width: 50%">
                                                                <table runat="server" cellpadding="0" cellspacing="0" style="width: 95%; margin-bottom: 5px">
                                                                    <tr>
                                                                        <td style="width: 50">
                                                                            Assignment Name:
                                                                        </td>
                                                                        <td style="width: 75%">
                                                                            <asp:TextBox ID="txtAssignmentName" runat="server" Text='<%# Bind("AssignmentName") %>'></asp:TextBox>
                                                                            <asp:RequiredFieldValidator runat="server" ID="rqAssignmentName" ErrorMessage="Please enter assignment name." Display="Dynamic" ControlToValidate="txtAssignmentName"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50">
                                                                            Assignment Desc:
                                                                        </td>
                                                                        <td style="width: 75%">
                                                                            <asp:TextBox ID="txtAssignmentDesc" runat="server" Text='<%# Bind("AssignmentDesc") %>'></asp:TextBox>
                                                                            <asp:RequiredFieldValidator runat="server" ID="rqAssignmentDesc" ErrorMessage="Please enter assignment description." Display="Dynamic" ControlToValidate="txtAssignmentDesc"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50">
                                                                            Date Assigned:
                                                                        </td>
                                                                        <td style="width: 75%">
                                                                            <asp:TextBox ID="txtDateAssigned" runat="server" Text='<%# Bind("DateAssigned") %>'></asp:TextBox>
                                                                            <asp:RequiredFieldValidator runat="server" ID="rqDateAssigned" ErrorMessage="Please enter assigned date." Display="Dynamic" ControlToValidate="txtDateAssigned"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50">
                                                                            Date To Be Completed:
                                                                        </td>
                                                                        <td style="width: 75%">
                                                                            <asp:TextBox ID="txtDateToBeCompleted" runat="server" Text='<%# Bind("DateToBeCompleted") %>'></asp:TextBox>
                                                                            <asp:RequiredFieldValidator runat="server" ID="rqDateToBeCompleted" ErrorMessage="Please enter date to be completed." Display="Dynamic" ControlToValidate="txtDateToBeCompleted"></asp:RequiredFieldValidator>
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td style="width: 50">
                                                                            Date Completed:
                                                                        </td>
                                                                        <td style="width: 75%">
                                                                            <asp:TextBox ID="txtDateCompleted" runat="server" Text='<%# Bind("DateCompleted") %>'></asp:TextBox>
                                                                            
                                                                        </td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td colspan="2">
                                                                            <div style="float: left; padding-left: 40%;">
                                                                                <asp:Button runat="server" ID="btnPerformInsert"  Text="Insert" CommandName="PerformInsert" />
                                                                                <asp:Button runat="server" ID="btnCancel" Text="Cancel" CommandName="PerformCancel" CausesValidation="false" />
                                                                            </div>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </fieldset>
                                </InsertItemTemplate>
                            </telerik:RadListView>
                        </asp:Panel>
                     </td>
                  </tr>
               </table>    
 
           </td>
        </tr>
 
             <tr>
            <td>
                <asp:Button runat="server" ID="btnUpdateRecord" OnClick="btnUpdateRecord_Click" Text="Update" /> <asp:Label runat="server" ID="idCondition" ForeColor="Red" Width="300px"></asp:Label>
            </td>
            <td>
                 <asp:Button runat="server" ID="btnNewAssignment" OnClick="btnNewAssignment_Click" Text="New Assignment" />
            </td>
        </tr>
        
     </table>
<telerik:RadListView ID="RadListView2" DataSourceID="SqlDataSource2" runat="server"
                        ItemPlaceholderID="CategoriesContainer" GroupPlaceholderID="GroupCategoriesContainer"
                        GroupItemCount="3" DataKeyNames="homeworkID" OnSelectedIndexChanged="RadListView2_SelectedIndexChanged">
                        <LayoutTemplate>
                            <fieldset id="GroupCategoriesContainer" runat="server">
                            </fieldset>
                        </LayoutTemplate>
                        <GroupTemplate>
                            <fieldset style="float: left;">
                                <legend>Categories group</legend>
                                <table>
                                    <tr>
                                        <asp:PlaceHolder ID="CategoriesContainer" runat="server"></asp:PlaceHolder>
                                    </tr>
                                </table>
                            </fieldset>
                        </GroupTemplate>
                        <EmptyItemTemplate>
                            <td>
                                                                <div class="itemDiv">
                                      
                                </div>
                            </td>
                        </EmptyItemTemplate>
                        <SelectedItemTemplate>
                            <td>
                                <asp:LinkButton ID="imgButton" runat="server" CommandName="Select">
                                    <telerik:RadBinaryImage ID="RadBinaryImage1" runat="server" AlternateText="Category Photo"
                                        Style="margin-left: 10px" ToolTip="Category Photo" Width="90px" Height="62px"
                                        BorderColor="#58954D" BorderWidth="2px" ResizeMode="Fit" ImageUrl='<%# string.Format("IMG/{0}.jpg", Eval("CategoryID")) %>'>
                                    </telerik:RadBinaryImage>
                                </asp:LinkButton>
                                <div class="selectedDiv">
                                    <%#Eval("homeworkID")%>
                                </div>
                            </td>
                        </SelectedItemTemplate>
                    </telerik:RadListView>
     <asp:SqlDataSource SelectCommandType="Text" SelectCommand="Select [UserID], FullName FROM [BulletinBoardDataBase].[dbo].[tbl_RegistrationForm]" ID="SqlDataSource1" runat="server" ConnectionString="Data Source=ENTERDUMMYINFOHERE-PC\ENTERDUMMYINFOHERE;Initial Catalog=BulletinBoardDataBase;Integrated Security=True">
     </asp:SqlDataSource>
       <asp:SqlDataSource SelectCommandType="Text" InsertCommand="INSERT INTO [dbo].[tbl_HomeWork] ([homeworkID] ,[UserID], [DateAssigned],[DateToBeCompleted],[AssignmentName],[AssignmentDesc],[AssignmentCompleted],[AssignmentIncomplete],[DateCompleted]) VALUES (@homeworkID ,@UserID , @DateAssigned, @DateToBeCompleted, @AssignmentName ,@AssignmentDesc ,@AssignmentCompleted ,@AssignmentIncomplete ,@DateCompleted)" DeleteCommand="DELETE FROM [BulletinBoardDataBase].[dbo].[tbl_HomeWork] Where UserID=@UserID And homeworkID=@homeworkID" UpdateCommand="UPDATE FROM [BulletinBoardDataBase].[dbo].[tbl_HomeWork] Set DateAssigned=@DateAssigned,DateCompleted=@DateCompleted, DateToBeCompleted=@DateToBeCompleted, AssignmentName=@AssignmentName, AssignmentDesc=@AssignmentDesc, AssignmentCompleted=@AssignmentCompleted, AssignmentInComplete=@AssignmentInComplete Where UserID = @UserID" SelectCommand="SELECT [homeworkID],[UserID],[DateAssigned],[DateToBeCompleted],[DateCompleted],[AssignmentName],[AssignmentDesc] FROM [BulletinBoardDataBase].[dbo].[tbl_HomeWork] Where UserID=@UserID" ID="SqlDataSource2" runat="server" ConnectionString="Data Source=ENTERDUMMYINFOHERE-PC\ENTERDUMMYINFOHERE;Initial Catalog=BulletinBoardDataBase;Integrated Security=True">
            <SelectParameters>
                <asp:Parameter Name="UserID" Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="UserID" Type="Int32" />
                <asp:Parameter Name="DateAssigned" Type="DateTime" />
                <asp:Parameter Name="DateToBeCompleted" Type="DateTime" />
                <asp:Parameter Name="AssignmentName" Type="String" />
                <asp:Parameter Name="AssignmentDesc" Type="String" />
                <asp:Parameter Name="AssignmentCompleted" Type="Boolean" />
                <asp:Parameter Name="AssignmentInComplete" Type="Boolean" />
                <asp:Parameter Name="DateCompleted" Type="DateTime" />
            </UpdateParameters>
            <DeleteParameters>
                <asp:Parameter Name="UserID" Type="Int32" />
                <asp:Parameter Name="homeworkID" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="homeworkID" Type="Int32" />
                <asp:Parameter Name="UserID" Type="Int32" />
                <asp:Parameter Name="DateAssigned" Type="DateTime" />
                <asp:Parameter Name="DateToBeCompleted" Type="DateTime" />
                <asp:Parameter Name="AssignmentName" Type="String" />
                <asp:Parameter Name="AssignmentDesc" Type="String" />
                <asp:Parameter Name="AssignmentCompleted" Type="Boolean" />
                <asp:Parameter Name="AssignmentIncomplete" Type="Boolean" />
                <asp:Parameter Name="DateCompleted" Type="DateTime" />
            </InsertParameters>
     </asp:SqlDataSource>
    
</asp:Content>


Down here is the backend code:

Imports System.Data.SqlClient
Imports System.Data
Imports System.Net.Mail
Imports Telerik.Web.UI
 
Partial Class EditAssignHomework
    Inherits System.Web.UI.Page
    Private lngHomeUSerID As Long()
    Private connectionString As String = "Data Source=ENTERDUMMYDATAHERE-PC\ENTERDUMMYDATAHERE;Initial Catalog=BulletinBoardDataBase;Integrated Security=True"
    Protected Sub lstStudentNames_ItemDataBound(sender As Object, e As Telerik.Web.UI.DropDownListItemEventArgs) Handles lstStudentNames.ItemDataBound
        e.Item.Attributes.Add("UserID", TryCast(e.Item.DataItem, DataRowView)("UserID").ToString())
    End Sub
 
 
 
    Protected Sub lstStudentNames_ItemSelected(sender As Object, e As Telerik.Web.UI.DropDownListEventArgs) Handles lstStudentNames.ItemSelected
        Dim selectedItem As Telerik.Web.UI.DropDownListItem = lstStudentNames.SelectedItem
        ViewState("lngUserID") = selectedItem.Attributes("UserID").ToString
        ' Here we are getting details of all the assignments the student have being assigned.
 
        RadListView1.DataBind()
    End Sub
    Protected Sub btnInitInsert_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        RadListView1.ShowInsertItem()
        RadListView1.FindControl("btnInitInsert").Visible = False
 
    End Sub
    Protected Sub lstStudentNames_SelectedIndexChanged(sender As Object, e As Telerik.Web.UI.DropDownListEventArgs) Handles lstStudentNames.SelectedIndexChanged
 
    End Sub
    Protected Sub rblSort_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
 
    End Sub
    Protected Sub ddListSort_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
 
    End Sub
 
    Protected Sub btnUpdateRecord_Click(sender As Object, e As System.EventArgs) Handles btnUpdateRecord.Click
 
    End Sub
 
    Protected Sub btnNewAssignment_Click(sender As Object, e As System.EventArgs) Handles btnNewAssignment.Click
 
    End Sub
    Protected Sub RadListView1_ItemCommand(sender As Object, e As Telerik.Web.UI.RadListViewCommandEventArgs) Handles RadListView1.ItemCommand
        If (e.CommandName = RadListView.PerformInsertCommandName) OrElse (e.CommandName = RadListView.UpdateCommandName) OrElse (e.CommandName = RadListView.CancelCommandName) Then
            RadListView1.InsertItemPosition = RadListViewInsertItemPosition.None
            RadListView1.FindControl("btnInitInsert").Visible = True
            RadListView2.Visible = True
        End If
 
 
    End Sub
 
    Protected Sub SqlDataSource2_Deleting(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource2.Deleting
        e.Command.Parameters("@UserID").Value = ViewState("lngUserID")
 
        ' Dim fvLabel As Label = DirectCast(CType(Page.FindControl("lblHomeWorkID"), Label), Label)
        ' e.Command.Parameters("@homeworkID").Value = fvLabel.Text
 
    End Sub
 
    Protected Sub SqlDataSource2_Inserting(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles SqlDataSource2.Inserting
        ViewState("lnghomeworkID") = Convert.ToInt32(ViewState("lnghomeworkID")) + 1
        e.Command.Parameters("@homeworkID").Value = ViewState("lnghomeworkID")
        e.Command.Parameters("@UserID").Value = ViewState("lngUserID")
 
        ' First before we retrieve password we are going to check first to make sure that the user actually exist
        Dim connection As New SqlConnection(connectionString)
        Dim command As New SqlCommand
        command.Connection = connection
        command.CommandText = "Select * From [BulletinBoardDataBase].[dbo].[tbl_RegistrationForm] Where UserID='" & ViewState("lngUserID") & "'"
        connection.Close()
        connection.Open()
        Dim reader As SqlDataReader = command.ExecuteReader()
        Dim email As String = Nothing
        Dim FullName As String = Nothing
 
        While (reader.Read())
            email = reader("Email")
            FullName = reader("FullName")
        End While
        connection.Close()
 
        connection.Close()
        Dim Message As New MailMessage("fakeemail@gmail.com", email, "Assignment assigned to " & FullName & ".", "This is an automatic message. Please do not reply back to this email. If you have questions to ask about the assignment please email fakedemail@gmail.com, thank you. " & FullName & " you have a new assignment assigned to you. Please login to your profile to obtain your assignment if you do not fulfill your assignment at the deadline it is assigned to you it will go to the incomplete assignment.")
        Dim client As New SmtpClient()
        client.Send(Message)
    End Sub
 
    Protected Sub SqlDataSource2_Selecting(sender As Object, e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource2.Selecting
        e.Command.Parameters("@UserID").Value = ViewState("lngUserID")
 
    End Sub
    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
 
    End Sub
    Protected Sub RadListView1_ItemDataBound(sender As Object, e As Telerik.Web.UI.RadListViewItemEventArgs) Handles RadListView1.ItemDataBound
 
    End Sub
 
    Protected Sub RadListView1_PreRender(sender As Object, e As System.EventArgs) Handles RadListView1.PreRender
        'Try
        '    For Each item As RadListViewDataItem In RadListView1.Items
 
        '        hiddenListBox.Items.Add(CType(item.FindControl("lblHomeWorkID"), Label).Text)
        '        hiddenListBox.DataBind()
        '    Next
        'Catch ex As Exception
 
        'End Try
         
    End Sub
    Protected Sub RadListView1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles RadListView1.SelectedIndexChanged
 
    End Sub
 
 
End Class

Any help on this would be SUPER sweet!!
xboxown
Top achievements
Rank 1
 answered on 08 May 2013
10 answers
596 views
    I have apage with an RadAjaxManager on it.. in my web user control I attempt to get set the RadAjaxManager variable using the RadAjaxManager.GetCurrent so that i can initiate an ajax postback with javascript when a radwindow closes...

?
Aaron
Top achievements
Rank 1
 answered on 08 May 2013
1 answer
52 views
I have several dock zones with multiple docks. I have one that I want to remain in position 0 always and the remaining docks should be able to be repositioned as the user desires.

I've tried setting the properties to: Pinned="true" DockMode="Docked" EnableDrag="false" and the dock will not move, however, if a user drags the dock to the 0 position, the first dock repositions.

The reason I need to do this is that I am using a collapsable dock as a filter that should remain at the top of the zone 100% of the time.

Is there a setting I am missing or is this not possible?
Slav
Telerik team
 answered on 08 May 2013
2 answers
301 views
I have a RadGrid with horizontal scrolling.  On the initial load, I wish to have the position set to the far right.  How do I set this position?
Matt
Top achievements
Rank 1
 answered on 08 May 2013
2 answers
109 views
My telerik grid below works just fine. However once I add the below code to enable scrolling the grid no longer re sizes correctly.
<ClientSettings>
      <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True"/>
</ClientSettings>


It now has a large amount of space between the last row in the grid and the footer or bottom of the grid?

Here is my code:
<head runat="server">
    <link rel="Stylesheet" type="text/css" href="./Styles.css" />
    <title>Content Tracker</title>
</head>
<body class="body">
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
     
    <!-- Page Header -->
        <div class="header">
            <table width="1000px">
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td>
                                    <img alt="" src="./Images/xxxxx_Logo_Small.gif" />
                                </td>
                            </tr>
                        </table>
                    </td>
                    <td style="float: right">
                        <table border="0">
                            <tr>
                                <td>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <b>Welcome <asp:Label ID="loggedInUser" runat="server" /></b>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
         
        <div id="Nav" class="nav"></div>
        <div id="spacer" class="divSpacer"></div>
 
    <!-- Page Content -->
    <div id="content" class="content" >
 
    <telerik:RadGrid ID="RadGrid1" Width="990" runat="server" DataSourceID="EntityDataSourceAssignments"
        AllowPaging="True" AllowAutomaticUpdates="True" AllowAutomaticInserts="True" GridLines="Both"
        AllowAutomaticDeletes="true" AllowSorting="true"
        OnItemCreated="RadGrid1_ItemCreated" OnItemInserted="RadGrid1_ItemInserted" OnPreRender="RadGrid1_PreRender">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <MasterTableView DataSourceID="EntityDataSourceAssignments" AutoGenerateColumns="False"
            DataKeyNames="AssignmentsID" CommandItemDisplay="Top">
            <Columns>
                <telerik:GridBoundColumn DataField="JurisdictionCode" HeaderText="Jurisdiction Code" SortExpression="JurisdictionCode"
                    UniqueName="JurisdictionCode" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ObligationName" HeaderText="Obligation Name" SortExpression="ObligationName"
                    UniqueName="ObligationName" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DevTeamLead" HeaderText="Dev Team Lead" SortExpression="DevTeamLead"
                    UniqueName="DevTeamLead" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Developer" HeaderText="Developer" SortExpression="Developer"
                    UniqueName="Developer" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="TestTeamLead" HeaderText="Test Team Lead" SortExpression="TestTeamLead"
                    UniqueName="TestTeamLead" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DueDate" HeaderText="Due Date" SortExpression="DueDate"
                    UniqueName="DueDate" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="FormsReceived" HeaderText="Forms Received" SortExpression="FormsReceived"
                    UniqueName="FormsReceived" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="EfileComplete" HeaderText="Efile Complete" SortExpression="EfileComplete"
                    UniqueName="EfileComplete" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ESEXTStatus" HeaderText="ES-EXT Status" SortExpression="ESEXTStatus"
                    UniqueName="ESEXTStatus" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="SubmittalStatus" HeaderText="Submittal Status" SortExpression="SubmittalStatus"
                    UniqueName="SubmittalStatus" Visible="true">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Priority" HeaderText="Priority" SortExpression="Priority"
                    UniqueName="Priority" Visible="true">
                </telerik:GridBoundColumn>
 
                <telerik:GridButtonColumn Text="Delete" CommandName="Delete" ButtonType="ImageButton" />
            </Columns>
            <EditFormSettings>
                <EditColumn ButtonType="ImageButton" />
            </EditFormSettings>
        </MasterTableView>
        <ClientSettings>
            <Scrolling AllowScroll="True" UseStaticHeaders="True" SaveScrollPosition="True">
            </Scrolling>
        </ClientSettings>
    </telerik:RadGrid>
    <asp:EntityDataSource ID="EntityDataSourceAssignments" runat="server" ConnectionString="name=ContentTrackerEntities"
        DefaultContainerName="ContentTrackerEntities" EntitySetName="Assignments" EnableUpdate="True" EnableDelete="True" EnableInsert="True">
    </asp:EntityDataSource>
    </div>
 
    <div id="page-footer">
        <div id="page-footer-copyright">Copyright © 2010-2012 xxxxxx. All rights reserved.</div>
    </div>
 
    </form>
Julian
Top achievements
Rank 1
 answered on 08 May 2013
14 answers
747 views
Ive been using the FileExplorer successfully when the folder(s) is in the web application.   Im now working on an application where the folder is outside the web application i.e. c:\test .  I can list  the folders/files using GetDirectories and GetFiles in System.IO.  For consistency id like to use the FileExplorer control.  Is this possible and can you point me to a sample - I was unable to find one.
Vessy
Telerik team
 answered on 08 May 2013
4 answers
125 views
I have created a RadGrid in the Page_init and have declared a GridTableView to incorporate the hierarchy.

RadGrid1.MasterTableView.HierarchyDefaultExpanded = True
Dim tableSubCode As New GridTableView(RadGrid1)
tableSubCode.Name = "SubCodes"
tableSubCode.Width = Unit.Percentage(100)
Dim relationFields1 As GridRelationFields = New GridRelationFields()
relationFields1.MasterKeyField = "DetailID"
relationFields1.DetailKeyField = "DetailID"
tableSubCode.ParentTableRelation.Add(relationFields1)
RadGrid1.MasterTableView.DetailTables.Add(tableSubCode)
columnSubCodeCreation("SubCode", "Sub_Code", tableSubCode)
columnSubCodeCreation("Household", "HouseHold_Count", tableSubCode)
If mstrClientDataCategoryID1Description.Trim <> "" Then
    columnSubCodeCreation(mstrClientDataCategoryID1Description.Trim, "CD1", tableSubCode)
End If
If mstrClientDataCategoryID2Description.Trim <> "" Then
    columnSubCodeCreation(mstrClientDataCategoryID2Description.Trim, "CD2", tableSubCode)
End If
If mstrClientDataCategoryID3Description.Trim <> "" Then
    columnSubCodeCreation(mstrClientDataCategoryID3Description.Trim, "CD3", tableSubCode)
End If
If mstrReportDemographicID1Description.Trim <> "" Then
    columnSubCodeCreation(mstrReportDemographicID1Description.Trim, "Demographic1", tableSubCode)
End If
If mstrReportDemographicID2Description.Trim <> "" Then
    columnSubCodeCreation(mstrReportDemographicID2Description.Trim, "Demographic2", tableSubCode)
End If
If mstrReportDemographicID3Description.Trim <> "" Then
    columnSubCodeCreation(mstrReportDemographicID3Description.Trim, "Demographic3", tableSubCode)
End If
If mstrReportDemographicID4Description.Trim <> "" Then
    columnSubCodeCreation(mstrReportDemographicID4Description.Trim, "Demographic4", tableSubCode)
End If
If mstrReportDemographicID5Description.Trim <> "" Then
    columnSubCodeCreation(mstrReportDemographicID5Description.Trim, "Demographic5", tableSubCode)
End If
columnSubCodeCreation("Selected", "Selected", tableSubCode)
If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then
    columnSubCodeCreation("Forced", "Forced", tableSubCode)
End If
columnSubCodeCreation("Circ", "Circ", tableSubCode)
columnSubCodeCreation("Coverage", "Coverage", tableSubCode)
If UcHeader.objSession.ApplicationId <> CInt(ConfigurationManager.AppSettings("MediaviewerAppID")) Then
    Dim dpCounter As Integer = 1
    Dim dpCollection As IList(Of RadListBoxItem) = rlbDistributionPatterns.CheckedItems
    For Each item As RadListBoxItem In dpCollection
        columnSubCodeCreation(item.Text, "DP" & dpCounter.ToString, tableSubCode)
        dpCounter += 1
    Next
End If

My Hierarchy is expanded as a default. So the RadGrid1_DetailTableDataBind is called for every parent row about 1200 with a pagesize of 100. I only want to set the datasource when dealing with 3 of my parents.
Private Sub RadGrid1_DetailTableDataBind(sender As Object, e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadGrid1.DetailTableDataBind
    Dim dataItem As GridDataItem = CType(e.DetailTableView.ParentItem, GridDataItem)
    Select Case e.DetailTableView.Name
        Case "SubCodes"
            Dim detailID As Integer = dataItem.GetDataKeyValue("DetailID").ToString()
            'Dim Geography As String = dataItem.GetDataKeyValue("Geography").ToString()
            'Dim CirculationTypeID As Integer = dataItem.GetDataKeyValue("CirculationTypeID").ToString()
            Dim Day As String = dataItem.GetDataKeyValue("Day").ToString()
            If mintCircSetID > 0 And (detailID = 29 Or detailID = 506 Or detailID = 509) Then
                e.DetailTableView.DataSource = GetDataTable(mstrSQL & ",1," & detailID & ",'" & Day & "'")
            End If
    End Select
End Sub

When I do this, for the parent rows that I do not want to call the datasource, a Child View does come up with the Parents information in it. For the 3 rows I actually call, the correct information comes up. I do not want the Child View of the other parents to show. I am doing this this way for effeciency. I see my performance times greatly shrink if I only assign the datasource to the parents I want and not have the call to every parent. How can I stop from the child view showing up on the other parents?
David Kucharski
Top achievements
Rank 1
 answered on 08 May 2013
3 answers
272 views
Dear Telerik team

I have the same issue that requested in this post.

I want to load all the records into the radgrid without using Normal paging or Virtual scrolling /paging.

for example my datasource have 9,000 rows, i want to render first 100 record at user button click
then automatically loading the rest by 100 row per travel to server appending the data displayed on the grid.

something like buffering.

Is that applicable with RadGrid ?

Thanks in advance. 


Elliott
Top achievements
Rank 2
 answered on 08 May 2013
0 answers
183 views
How can i remove RadScriptManager from a page?  I want to include the JS manualy with <script /> tags instead of using the  RadScriptManager on a few pages I have.  I already found all the JS the Telerik controls on the page are using but when I try and include them outside the RadScriptManager the page throws JS errors.
Andrew
Top achievements
Rank 1
 asked on 08 May 2013
3 answers
298 views
I have created a usercontrol to edit the values on a RadGrid.  One of the fields on the grid is stored in the database as a comma separated string.  In order to allow the user to change the stored values for this field, a multiselect listbox has been placed on the usercontrol.  Currently I use the edit event to store the currentvalues in this field in a session variable.  Then on the databound event, I retrieve the value from the session variable, parse them and select the appropriate rows in the listbox to show what the past values were.  The code works but I was wondering if there was any way to use the bind statement to effect the same end?  If there is only one value to be selected the bind will work but if more than one value is to be selected I don't know of or how the bind statement would work.
Daniel
Telerik team
 answered on 08 May 2013
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?