This is a migrated thread and some comments may be shown as answers.

Update Panel Problem

6 Answers 423 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 09 Sep 2008, 08:23 AM
When I click next page in radgrid it shows the following error.


Cannot unregister UpdatePanel with ID 'ctl00$ContentPlaceHolder1$RadProduct$ctl00$ctl05$ctl01$grdStockPanel' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel

6 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 17 Sep 2008, 11:24 AM
Hello Priya,

From the exception trace it seems that the update panel which wraps the grid instance cannot be unregistered by the ScriptManager due to the reason specified in the message.

Have you ajaxified the grid by means of MS UpdatePanel? Does the same issue occur if you replace it with standard GridView control and enable paging for it? The answers to these questions can help us determine the cause of the issue to eliminate it.

I will also appreciate if you paste the problematic grid definition along with its code-behind in this forum post. I will review it and will advice you further.

Best regards,
Stephen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Priya
Top achievements
Rank 1
answered on 17 Sep 2008, 11:43 AM

<%

@ Page Language="VB" MasterPageFile="~/ESCCMaster.master" AutoEventWireup="false" CodeFile="Product_List.aspx.vb" Inherits="Product_List" title="Product List" %>

<%

@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<%

@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<%

@ Register Src="~/StockAdd.ascx" TagName="StockAdd" TagPrefix="uc1" %>

<%

@ Register Src="~/Product_Edit.ascx" TagName="ProductEdit" TagPrefix="uc2" %>

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<telerik:RadScriptBlock runat="server" ID="RadScriptBlock1" >

<%

--<script type="text/javascript" src="JavaScripts/SelectingLogic.js"></script>--%>

<script type="text/javascript">

function RequestStart(sender, args)

{

args.EventTargetElement.disabled =

true;

}

function ResponseEnd(sender, args)

{

args.EventTargetElement.disabled =

false;

}

function RowSelecting(rowObject)

{

//get the input check box

var inputCheckBox = rowObject.Control.getElementsByTagName("input")[0];

if (inputCheckBox.disabled)

{

//cancel selection

return false;

}

}

function radalertClick()

{

var msg=document.getElementById("<%=lblalertMessage.ClientID%>").value;

alert(msg);

}

function OnClientItemsRequesting(sender, args)

{

if(sender.GetText().length < 1)

{

return false;

}

else

{

sender.ClearItems();

}

}

function RowSelecting(rowObject)

{

//get the input check box

var inputCheckBox = rowObject.Control.getElementsByTagName("input")[0];

if (inputCheckBox.disabled)

{

//cancel selection

return false;

}

}

var ival = 0

function ShowMenu()

{

if (ival == 1 || ival == 0)

{

parent.document.body.cols=

'0,100%'

ival = 2

}

else if (ival == 2)

{

parent.document.body.cols=

'150, 100%'

ival = 1

}

}

function

openWin(Product_Id)

{

 

var oWnd = radopen("Dialog1.aspx?DiaLogId=" +Product_Id,"RadWindow1");

oWnd.add_close(OnClientClose)

}

function

openProductWindow(product_Id)

{

var oWnd = radopen("View_ProductDetails.aspx?Product_Id=" +product_Id,"RadWindow1");

oWnd.add_close(OnClientClose)

}

function openWinfavorate(Product_Id,rowIndex)

{

alert(rowIndex);

// var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();

// grid.get_masterTableView().selectItem(rowControl, true);

// alert(rowControl);

//

window.radopen(

"Dialog1.aspx?DialogId=" + Product_Id, "UserListDialog");

alert(

"Hai");

return false;

}

function OnClientClose(oWnd)

{

}

function CallBackFunction(radWindow, returnValue)

{

var oArea = document.getElementById("InfoArea");

if (returnValue) oArea.value = returnValue;

else alert ("No text was returned");

}

function

RowContextMenu(sender, eventArgs)

{

var menu = $find("<%=RadRelationMenu.ClientID %>");

var evt = eventArgs.get_domEvent();

// var index = eventArgs.get_itemIndexHierarchical();

// document.getElementById("RadRelationMenuClickedIndex").value= index;

//

// sender.get_masterTableView().selectItem(sender.get_masterTableView().get_dataItems()[index].get_element(), true);

menu.show(evt);

evt.cancelBubble =

true;

evt.returnValue =

false;

if (evt.stopPropagation)

{

evt.stopPropagation();

evt.preventDefault();

}

}

function conditionalPostback(e,sender)

{

var re = new RegExp("\.lnkaddimage$", "ig");

alert(re)

 

if (sender.EventTarget.match(re))

 

{

sender.EnableAjax =

 

false

;

}

}

// function CloseActiveToolTip(Product_Id)

// {

// var controller = Telerik.Web.UI.RadToolTipController.getInstance();

// var tooltip = controller.get_activeToolTip();

// if (tooltip) tooltip.hide();

//

// if(Product_Id)

// {

// //Rebind the DetailTable.

// setTimeout(function(){

// __doPostBack("<%= Radproduct.UniqueID %>", "DetailTableUpdated:" + Product_Id);

// }, 100);

// }

// }

</

script>

</telerik:RadScriptBlock>

<asp:label ID="lblproductId" runat="server" EnableViewState="true" Visible="false"/>

<asp:label ID="lblpartno" runat="server" EnableViewState="true" Visible="false"/>

<asp:label ID="lblproductdesc" runat="server" EnableViewState="true" Visible="false"/>

<asp:label ID="lblvendorname" runat="server" EnableViewState="true" Visible="false"/>

<asp:label ID="lblSupplierInternalId" runat="server" EnableViewState="true" Visible="false"/>

<asp:HiddenField ID="HidDelete" runat="server" />

<asp:HiddenField ID="hdproductId" runat="server" />

<div id="divMsgs" runat="server" style="float: left;">

<asp:Label ID="Label1" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#FF8080"></asp:Label>

<asp:Label ID="Label2" runat="server" EnableViewState="False" Font-Bold="True" ForeColor="#00C000"></asp:Label>

</div>

<div style=" ">

<%

--<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" >

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

<AjaxSettings>

<telerik:AjaxSetting AjaxControlID="RadProduct">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="RadProduct" LoadingPanelID="AjaxLoadingPanel1" />

<telerik:AjaxUpdatedControl ControlID="RadRelationMenu" />

</UpdatedControls>

</telerik:AjaxSetting>

<telerik:AjaxSetting AjaxControlID="RadRelationMenu">

<UpdatedControls>

<telerik:AjaxUpdatedControl ControlID="RadProduct" LoadingPanelID="AjaxLoadingPanel1" />

<telerik:AjaxUpdatedControl ControlID="RadRelationMenu" />

</UpdatedControls>

</telerik:AjaxSetting>

</AjaxSettings>

</telerik:RadAjaxManager>

<br />

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px"

Width="75px" Transparency="20">

<img alt="Loading..." src="Images/loading.gif"

style="border: 0;" />

<asp:Label ID="lblErrMsg" runat="server"></asp:Label>

</telerik:RadAjaxLoadingPanel>

<br />

--

%>

<asp:ScriptManagerProxy runat="server" ID="scmanagerprocy">

</asp:ScriptManagerProxy>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>

<telerik:RadTabStrip Visible="false" ID="RadTabStrip1" runat="server" Skin="Web20" MultiPageID="RadMultiPage1"

SelectedIndex="1" CssClass="tabStrip" >

<Tabs>

<telerik:RadTab Text="Manufacture Part" runat="server" Selected="True">

</telerik:RadTab>

<telerik:RadTab Text="Vendor Part" runat="server">

</telerik:RadTab>

</Tabs>

</telerik:RadTabStrip>

<asp:Label ID="lblproduct" runat="server"></asp:Label>

<telerik:RadMultiPage ID="RadMultiPage1" runat="server" SelectedIndex="0" CssClass="multiPage">

<telerik:RadPageView ID="RadPageProduct" runat="server">

<telerik:RadGrid ID="RadProduct" Visible="true" AllowMultiRowSelection="true" AllowSorting="true" enableajax="false" ShowGroupPanel="True" runat="server" AllowPaging="True" PageSize="10" Skin="gridnewstyle" EnableEmbeddedSkins="false" GridLines="None" Width="100%"

ShowStatusBar="true" ShowFooter="True" AutoGenerateColumns="false" OnItemDataBound="RadProduct_ItemDataBound" >

<PagerStyle Mode="NextPrevAndNumeric" Position="bottom" EnableSEOPaging="true"/>

<MasterTableView GroupLoadMode="client" AllowSorting="true" DataKeyNames="product_id,SUP_INTERNAL_ID" CommandItemDisplay="Top" >

<CommandItemTemplate>

<div style=" padding-top:7px; padding-bottom:7px;">

<asp:LinkButton ID="lnlAddNew" runat="server" CommandName="addnewproduct" CssClass="addnew" >

Add new

</asp:LinkButton><span class="divider"></span>

<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" CssClass="edit" Enabled="true" >

Edit

</asp:LinkButton><span class="divider"></span>

<asp:LinkButton Text="Delete" ID="lnkdelete" OnClientClick="javascript:return confirm('Delete all selected Products?')"

runat="server" CommandName="DeleteSelected" CssClass="delete" Enabled="true">

</asp:LinkButton><span class="divider"></span>

<asp:LinkButton ID="lnkmove" runat="server" CommandName="MoveSelected" CssClass="move" Enabled="true" >

Move

</asp:LinkButton><span class="divider"></span>

<asp:LinkButton ID="btnprint" runat="server" CommandName="EditSelected" CssClass="print" Enabled="true" >

Print

</asp:LinkButton><span class="divider"></span>

<asp:LinkButton ID="lnkAddtoVendor" runat="server" CommandName="AddtoVendor" CssClass="addvendor" Enabled="true" >

Add Vendor

</asp:LinkButton>

</

div>

</CommandItemTemplate>

<GroupByExpressions>

<telerik:GridGroupByExpression>

<SelectFields>

<telerik:GridGroupByField FieldAlias="SUPPLIER_Name" FieldName="SUPPLIER_Name" HeaderText="Manufacture Name"></telerik:GridGroupByField>

</SelectFields>

<GroupByFields>

<telerik:GridGroupByField FieldName="SUPPLIER_Name" HeaderText=""></telerik:GridGroupByField>

</GroupByFields>

</telerik:GridGroupByExpression>

</GroupByExpressions>

<AlternatingItemStyle />

<Columns>

<telerik:GridClientSelectColumn Reorderable="False" UniqueName="ClientSelectColumn">

<HeaderStyle Width="20px"></HeaderStyle>

</telerik:GridClientSelectColumn>

<telerik:GridTemplateColumn >

<ItemTemplate>

<img class="primg" src='<%# ParseImage(DataBinder.Eval(Container.DataItem, "PRODUCT_IMAGE_LINK"))%>'/>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridBoundColumn DataField="Product_Id" Visible="false" UniqueName="Product_Id"></telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="SUP_INTERNAL_ID" Visible="false" UniqueName="SUP_INTERNAL_ID"></telerik:GridBoundColumn>

<telerik:GridTemplateColumn DataField="product_name" HeaderText="Product Details"

UniqueName="product_name">

<ItemStyle Width="25%" />

<HeaderStyle />

<ItemTemplate>

<asp:Label ID="lblProductName" Visible="true" Font-Bold="true" Font-Underline="true" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "product_name")%>' ></asp:Label>

<div class="divMsgs">

<br />

<div class="" >part#

<asp:LinkButton runat="server" CommandName="select" Text='<%# DataBinder.Eval(Container.DataItem, "PART_NO")%>' CommandArgument='<%#DataBinder.Eval(Container.DataItem, "PART_NO")%>' ID="lnkpartNo" />

</div>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn DataField="SUP_INTERNAL_ID" Visible="False"

UniqueName="PART_NO" >

<ItemTemplate>

<asp:Label ID="lblSupInternalId" runat="server" Visible="false" Text='<%# DataBinder.Eval(Container.DataItem, "SUP_INTERNAL_ID")%>'></asp:Label>

</ItemTemplate>

<HeaderStyle />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="product_type" HeaderText="ProductType">

<ItemTemplate>

<asp:Label id="Label1" runat="server"></asp:Label> '<%#DataBinder.Eval(Container.DataItem, "product_type")%>'

</ItemTemplate>

<HeaderStyle Width="30%"/>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="Price" HeaderText="Price">

<ItemTemplate> <HeaderStyle Width="30%" />

<asp:Label ID="lblunitPrice" CssClass="pricered" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "unit_price")%>'></asp:Label>

<br />

<asp:Label ID="lblunittypedesc" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "unit_type_desc")%>'></asp:Label>

<br />

<asp:Label ID="lblstockhead" runat="server"></asp:Label>

<asp:Label ID="lblStock" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Stock")%>'></asp:Label>

<br />

<asp:LinkButton CommandName="lnkedit" ID="lnkeditstock" runat="server" Text="Edit"></asp:LinkButton>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="SUPPLIER_ID" HeaderText="Manufacturer" >

<ItemTemplate>

<asp:Label id="lblManufacturer" runat="server"></asp:Label> '<%#DataBinder.Eval(Container.DataItem, "SUPPLIER_ID")%>'

</ItemTemplate>

<HeaderStyle Width="10px" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn UniqueName="Supplier_Name" Visible="false">

<ItemTemplate>

<asp:Label id="lblSuplier" Visible="false" runat="server"></asp:Label> '<%#DataBinder.Eval(Container.DataItem, "SUPPLIER_Name")%>'

</ItemTemplate>

<HeaderStyle Width="10px" />

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn Visible="false" UniqueName="unit_type_name" HeaderText="Unit">

<ItemTemplate>

<asp:Label id="lblUnittypt" runat="server"></asp:Label> '<%#DataBinder.Eval(Container.DataItem, "unit_type_name")%>'

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList id="lstUnitType" runat="server" />

</EditItemTemplate>

<HeaderStyle Width="10px" />

</telerik:GridTemplateColumn>

<telerik:GridNumericColumn datafield="Service_charge" HeaderText="Service Charge" NumericType="Number" Visible="False" UniqueName="Service_charge">

<HeaderStyle Width="10px" />

</telerik:GridNumericColumn>

<telerik:GridTemplateColumn UniqueName="TemplateColumn3">

<ItemTemplate>

<telerik:RadToolTipManager ManualClose="true" RelativeTo="Element" ID="RadToolTipManager1" runat="server"

Position="BottomRight" Animation="Fade" OnAjaxUpdate="OnAjaxUpdate" Skin="Default"

Width="280px" Height="250px" Style="font-size: 18px; text-align: center; font-family: Arial;" >

</telerik:RadToolTipManager>

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<EditFormSettings UserControlName="ProductEdit.ascx" EditFormType="WebUserControl">

<EditColumn UniqueName="EditCommandColumn1" >

</EditColumn>

<PopUpSettings ScrollBars="None" />

</EditFormSettings>

<ExpandCollapseColumn Resizable="False">

<HeaderStyle Width="20px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

<DetailTables >

<telerik:GridTableView DataKeyNames="SUP_INTERNAL_ID" Name="TableViewProduct" Width="100%" runat="server" >

<Columns>

<telerik:GridBoundColumn DataField="Product_Id" Visible="false" UniqueName="Product_Id"></telerik:GridBoundColumn>

<telerik:GridBoundColumn HeaderText="Vendor Name" DataField="SUPPLIER_NAME" ReadOnly="True" UniqueName="SUPPLIER_NAME" >

<ItemStyle HorizontalAlign="left" Width="30%" ></ItemStyle>

<HeaderStyle Width="10px" />

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Vendor_Part_No" HeaderText="Vendor PartNo" UniqueName="PartNo" ItemStyle-Width="20%"></telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="Product_Type" HeaderText="Product Type" UniqueName="Product_Type" ItemStyle-Width="20%"></telerik:GridBoundColumn>

<telerik:GridNumericColumn DataFormatString="{0:c2}" NumericType="Currency" DataField="Vendor_Cost" HeaderText="Vendor Cost" UniqueName="Vendor_Cost" ItemStyle-Width="20%"></telerik:GridNumericColumn>

</Columns>

<ParentTableRelation>

<telerik:GridRelationFields DetailKeyField="product_id" MasterKeyField="product_id" />

</ParentTableRelation>

<EditFormSettings>

<PopUpSettings ScrollBars="None" />

</EditFormSettings>

<ExpandCollapseColumn Resizable="False" Visible="False">

<HeaderStyle Width="20px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</telerik:GridTableView>

</DetailTables>

</MasterTableView>

<ClientSettings EnableRowHoverStyle="True" AllowExpandCollapse="true" ReorderColumnsOnClient="true" AllowDragToGroup="true" EnablePostBackOnRowClick="false">

<%

-- <ClientEvents OnRowContextMenu="RowContextMenu"></ClientEvents>--%>

<Selecting AllowRowSelect="True" />

</ClientSettings>

<AlternatingItemStyle />

</telerik:RadGrid>

<input id="SelectedRowsData" runat="server" type="hidden" />

<script type="text/javascript">

</script>

<telerik:RadWindowManager Modal="true" Behaviors="Maximize,Minimize,Move,Pin,Reload,Resize" ID="RadWindowManager1"

ShowContentDuringLoad="true" Width="900px" height="452px"

runat="server" Skin="Vista" Behavior="Default" ClientCallBackFunction=CallBackFunction>

</telerik:RadWindowManager>

<asp:HiddenField ID="field" runat="server" />

</telerik:RadPageView>

<telerik:RadPageView ID="RadPageVendorProduct" runat="server">

<table width="100%">

<tr>

<td>

<telerik:RadGrid ID="grdVendorProduct" Visible="true" runat="server" AllowPaging="True" ShowGroupPanel="true" PageSize="10" Skin="gridnewstyle" EnableEmbeddedSkins="false"

GridLines="None" Width="100%"

ShowStatusBar="true" ShowFooter="True" AutoGenerateColumns="false" AllowMultiRowSelection="True" style="border:none !important;">

<PagerStyle Mode="NextPrevAndNumeric" Position="Top" />

<MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top" DataKeyNames="SUP_INTERNAL_ID">

<AlternatingItemStyle />

<GroupByExpressions>

<telerik:GridGroupByExpression>

<SelectFields>

<telerik:GridGroupByField FieldAlias="SUPPLIER_Name" FieldName="SUPPLIER_Name" HeaderText="Vendor Name"></telerik:GridGroupByField>

</SelectFields>

<GroupByFields>

<telerik:GridGroupByField FieldName="SUPPLIER_Name" HeaderText=""></telerik:GridGroupByField>

</GroupByFields>

</telerik:GridGroupByExpression>

</GroupByExpressions>

<Columns>

<telerik:GridTemplateColumn HeaderText="Product Description">

<ItemTemplate >

<asp:label ID="lblProductName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Product_Name")%>'></asp:label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Vendro Part No" DataField="Vendor_Part_No" UniqueName="Vendor_Part_No" >

<ItemStyle HorizontalAlign="left"></ItemStyle>

<ItemTemplate >

<asp:label ID="lblVendorPartNo" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Vendor_Part_No")%>'></asp:label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Product Type" DataField="Product_Type" UniqueName="Product_Type" >

<ItemTemplate >

<asp:label ID="lblProductType" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Product_Type")%>'></asp:label>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Vendor Cost" UniqueName="Vendor_Cost" DataField="unit_Price">

<ItemTemplate >

<asp:label ID="lblProductCost" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "unit_Price")%>'></asp:label>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Vendor Name" DataField="Supplier_Name" UniqueName="Supplier_Name" >

<ItemTemplate >

<asp:label ID="lblVendoName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Supplier_Name")%>'></asp:label>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridTemplateColumn>

</Columns>

<ExpandCollapseColumn Resizable="False" Visible="False">

<HeaderStyle Width="20px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</MasterTableView>

<AlternatingItemStyle />

</telerik:RadGrid>

</td>

</tr>

</table>

</telerik:RadPageView>

</telerik:RadMultiPage>

</ContentTemplate>

</asp:UpdatePanel>

<table width="100%">

<tr>

<td>

<telerik:RadGrid ID="FavorateProductGrid" Visible="false" runat="server" AllowPaging="True" PageSize="10" Skin="gridnewstyle" EnableEmbeddedSkins="false"

GridLines="None" Width="100%"

ShowStatusBar="true" ShowFooter="True" AutoGenerateColumns="false" AllowMultiRowSelection="True" >

<PagerStyle Mode="NextPrevAndNumeric" Position="Top" />

<MasterTableView GridLines="None" Width="100%" CommandItemDisplay="Top" DataKeyNames="Product_Id">

<CommandItemTemplate>

<asp:LinkButton ID="lnlAddNew" runat="server" CommandName="InitInsert" >

<img style="border:0px;vertical-align:middle;" alt="" src="Images/AddRecord.gif" />Add new</asp:LinkButton>&nbsp;&nbsp;

<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected">

<img style="border:0px;vertical-align:middle;" alt="" src="Images/edit.gif" />Edit selected</asp:LinkButton>&nbsp;&nbsp;

 

</CommandItemTemplate>

<AlternatingItemStyle />

<Columns>

<telerik:GridTemplateColumn HeaderText="Manufacturer Code">

<ItemTemplate >

<asp:LinkButton ID="lnkfavorateproductname" CommandName="Favourite_Select" runat="server" Text='<%# Iantzclass.Highlight(strSrchKW,DataBinder.Eval(Container.DataItem, "Favourite_Name"),strSrchKW1)%>' />

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Product Description" DataField="product_name" UniqueName="Product_NAME" >

<ItemStyle HorizontalAlign="Center"></ItemStyle>

<ItemTemplate>

<asp:Label ID="lblproductName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "product_name")%>'></asp:Label>

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Part#" UniqueName="partNo" >

<ItemTemplate>

<asp:Label ID="lblppartNumber" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "PART_NO")%>'></asp:Label>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn HeaderText="Type" UniqueName="Type" >

<ItemTemplate>

<asp:Label ID="lblproductType" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "product_type")%>'></asp:Label>

</ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>

</telerik:GridTemplateColumn>

<telerik:GridBoundColumn DataField="unit_price" HeaderText="Price"

DataFormatString="{0:c}">

<ItemStyle Width="10%"></ItemStyle>

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="SUPPLIER_ID" HeaderText="Manufacturer">

<ItemStyle Width="18%"></ItemStyle>

</telerik:GridBoundColumn>

<telerik:GridBoundColumn DataField="unit_type_name" HeaderText="Unit">

<ItemStyle Width="5%"></ItemStyle>

</telerik:GridBoundColumn>

<telerik:GridTemplateColumn HeaderText="Product Description" DataField="product_name" UniqueName="Product_NAME" >

<ItemStyle HorizontalAlign="Center" Width="80px"></ItemStyle>

<ItemTemplate>

<image border="0" height="60" width="60" src='<%# ParseImage(DataBinder.Eval(Container.DataItem, "PRODUCT_IMAGE_LINK"))%>' />

</ItemTemplate>

</telerik:GridTemplateColumn>

<telerik:GridTemplateColumn Visible="false" ItemStyle-Wrap="false" ItemStyle-Width="5%" HeaderStyle-HorizontalAlign="center"

ItemStyle-HorizontalAlign="center">

<ItemTemplate>

<asp:LinkButton ID="lnkUnDelete" CssClass="Boldsublinks" Text="UnDelete" runat="server"

CommandName="UnDelete" ToolTip="Click to undelete this Product" />

</ItemTemplate>

</telerik:GridTemplateColumn>

</Columns>

<EditFormSettings UserControlName="Manufacturer_Add.ascx" EditFormType="WebUserControl">

<EditColumn UniqueName="EditCommandColumn1" >

</EditColumn>

<PopUpSettings ScrollBars="None" />

</EditFormSettings>

<ExpandCollapseColumn Resizable="False" Visible="False">

<HeaderStyle Width="20px" />

</ExpandCollapseColumn>

<RowIndicatorColumn Visible="False">

<HeaderStyle Width="20px" />

</RowIndicatorColumn>

</MasterTableView>

<ClientSettings >

<Selecting AllowRowSelect="True"></Selecting>

<ClientEvents OnRowSelecting="RowSelecting" />

</ClientSettings>

<AlternatingItemStyle />

</telerik:RadGrid>

</td></tr></table>

<%

--<! Vendor Product Details--%>

<%

--</telerik:RadPageView>

</telerik:RadMultiPage>

--

%>

<telerik:RadContextMenu ID="RadRelationMenu" runat="server" Skin="Vista" OnItemClick="RadRelationMenu_ItemClick" >

<Items>

<telerik:RadMenuItem Text="Add to Favorate" />

</Items>

<CollapseAnimation Duration="200" Type="OutQuint" />

</telerik:RadContextMenu>

<asp:HiddenField ID="hidfield" runat="server" Visible="true"/>

<

ajaxtoolkit:modalpopupextender id="ModalPopupExtender" runat="server" backgroundcssclass="modalBackground"

popupcontrolid="Panel1" popupdraghandlecontrolid="Panel3" TargetControlID="hidfield" ></ajaxtoolkit:modalpopupextender>

<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none" Width="400px" >

<div>

<table >

<tr>

<td >

<asp:Label ID="lblMessage" EnableViewState="true" runat="server" ></asp:Label>

</td>

</tr>

</table>

<asp:Button ID="YesButton" runat="server" Text="Yes" CssClass="btnb" />

<asp:Button ID="CancelButton" runat="server" Text="NO" CssClass="btnb" />

</div>

</asp:Panel>

&nbsp;

<br />

<div>

</div>

<%

--</telerik:RadAjaxPanel> --%>

<telerik:RadAjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Height="75px" Transparency="25"

Width="75px">

<asp:Image ID="Image1" runat="server" AlternateText="Loading..." ImageUrl="Images/loading.gif" />

</telerik:RadAjaxLoadingPanel>

</

div>

<

asp:Label ID="lblalertMessage" runat="server" ></asp:Label>

</

asp:Content>



Imports

System.Data

Imports

System.Web.UI.WebControls.WebParts

Partial

Class Product_List

Inherits System.Web.UI.Page

Dim strSortMethod As String

Dim intGridRowCount As Integer = 0

Protected strSrchKW As String = ""

Protected strSrchKW1 As String = ""

Dim nOperator As Integer = -1

Dim CheckFlag As Integer = 0

Dim objproductSupplierRelation As clsSupplierProductRelation

Dim objProduct As clsProducts

Dim objproductProperty As ProductProperty

Dim objSupplier As clsSuplier

Dim objSupplierProperty As SupplierProperty

Dim objSupplierAddressProperty As AddressProperty

Dim objSupplierContactProperty As AddressProperty

Dim objContact As ClsContact

Dim objContactProperty As AddressProperty

Dim ParentId As Int16

Dim DeleteLink As LinkButton

Dim MoveLink As LinkButton

Dim AddVendorLink As LinkButton

Dim EdititemLink As LinkButton

Dim PrintLink As LinkButton

Dim hidd As HiddenField

Dim strproductId As New StringBuilder

Sub New()

objproductSupplierRelation =

New clsSupplierProductRelation

objProduct =

New clsProducts

objproductProperty =

New ProductProperty

objSupplier =

New clsSuplier

objSupplierProperty =

New SupplierProperty

objSupplierAddressProperty =

New AddressProperty

objSupplierContactProperty =

New AddressProperty

objContact =

New ClsContact

End Sub

'Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadTabStripEventArgs) Handles RadTabStrip1.TabClick

'End Sub

Protected Sub RadProduct_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadProduct.ItemCommand

'If (e.CommandName = "RowClick" AndAlso TypeOf e.Item Is Telerik.Web.UI.GridDataItem) Then

' Dim ProdId As Int16 = e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("product_id")

' If objProduct.CheckIsObsoluted(ProdId) Then

' DeleteLink.Text = "Undelete"

' MoveLink.Enabled = False

' AddVendorLink.Enabled = False

' MoveLink.CssClass = "move_disable"

' AddVendorLink.CssClass = "addvendor_disable"

' DeleteLink.Enabled = True

' DeleteLink.CssClass = "delete"

' EdititemLink.Enabled = True

' EdititemLink.CssClass = "edit"

 

 

 

' Else

' DeleteLink.Text = "Delete"

' DeleteLink.Enabled = True

' MoveLink.Enabled = True

' AddVendorLink.Enabled = True

' EdititemLink.Enabled = True

' EdititemLink.CssClass = "edit"

' MoveLink.CssClass = "move"

' AddVendorLink.CssClass = "addvendor"

 

' PrintLink.Enabled = True

 

' End If

 

 

'End If

 

 

If e.CommandName = Telerik.Web.UI.RadGrid.SelectCommandName AndAlso TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then

If (e.Item.ItemIndex <> -1) Then

If e.CommandName = "select" Then

End If

 

Dim dataItem As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)

objproductProperty.ProductId = Convert.ToInt16(dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)(

"product_id"))

 

 

 

 

 

 

 

 

End If

 

 

 

End If

 

 

 

 

 

 

If e.CommandName = "AddtoVendor" Then

For Each item As Telerik.Web.UI.GridItem In RadProduct.SelectedItems

Dim editLink As LinkButton = DirectCast(e.Item.FindControl("lnkAddtoVendor"), LinkButton)

Dim lnkpartNo As LinkButton = DirectCast(item.FindControl("lnkpartNo"), LinkButton)

'Dim lblCost = item.FindControl("lblunitprice"),

Dim Cost As Int16 = item.OwnerTableView.DataKeyValues(item.ItemIndex)("unit_price")

Dim lblProductName As Label = DirectCast(item.FindControl("lblProductName"), Label)

Dim Product_Id As Int16 = item.OwnerTableView.DataKeyValues(item.ItemIndex)("product_id")

strproductId = strproductId.Append(Product_Id.ToString())

strproductId = strproductId.Append(

",")

hdproductId.Value = strproductId.ToString

Dim Supplier_InternalId As Int16 = item.OwnerTableView.DataKeyValues(item.ItemIndex)("SUP_INTERNAL_ID")

 

Next

Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow

newWindow.ID =

"RadWindow1"

hdproductId.Value = hdproductId.Value.TrimEnd(

",")

'newWindow.NavigateUrl = "Product_AddtoVendor.aspx?DiaLogId= " & hdproductId.Value ' & "&PartNo= " & lnkpartNo.Text & "&lblcost= " & Cost & "&lblProductName=" & lblProductName.Text & "&Supplier_InternalId=" & Supplier_InternalId

newWindow.NavigateUrl =

"default4.aspx?DiaLogId= " & hdproductId.Value ' & "&PartNo= " & lnkpartNo.Text & "&lblcost= " & Cost & "&lblProductName=" & lblProductName.Text & "&Supplier_InternalId=" & Supplier_InternalId

newWindow.VisibleOnPageLoad =

True

newWindow.ReloadOnShow =

True

newWindow.Modal =

True

RadWindowManager1.Windows.Add(newWindow)

RadWindowManager1.VisibleStatusbar =

False

 

End If

If e.CommandName = "AddtoFavorate" Then

Dim strScript As String

For Each item As Telerik.Web.UI.GridItem In RadProduct.SelectedItems

Dim editLink As LinkButton = DirectCast(e.Item.FindControl("lnkaddtofavorate"), LinkButton)

Dim Product_Id As Int16 = item.OwnerTableView.DataKeyValues(item.ItemIndex)("product_id")

'strScript = "<script language=javascript>"

'strScript += "openWinfavorate('" & dd & "' ,'" & tt & "');"

''strScript += "openWin1();"

'strScript += "<"

'strScript += "/script>"

'Page.RegisterStartupScript("mm", strScript)

objproductProperty.ProductId = Product_Id

objproductProperty.UserId = User.Identity.Name

Dim intFavorateProductCount As Int16 = objProduct.CheckIfProductAlreadyAddedToFavourites(objproductProperty)

If intFavorateProductCount > 0 Then

editLink = (

DirectCast(e.Item.FindControl("lnkaddtofavorate"), LinkButton))

'editLink.Attributes.Add("onclick", "radalert('This Product is Already added to Favorate');return false; ")

Else

 

Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow

newWindow.ID =

"RadWindow1"

newWindow.NavigateUrl =

"addtofavorate.aspx?product_Id=" + Product_Id.ToString

newWindow.VisibleOnPageLoad =

True

newWindow.ReloadOnShow =

True

newWindow.Modal =

True

RadWindowManager1.Windows.Add(newWindow)

RadWindowManager1.VisibleStatusbar =

False

End If

Next

 

 

 

End If

If e.CommandName = "addnewproduct" Then

Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow

newWindow.ID =

"RadWindow1"

newWindow.NavigateUrl =

"Product_Add.aspx?product_Id=0"

newWindow.VisibleOnPageLoad =

True

newWindow.ReloadOnShow =

True

newWindow.Modal =

True

RadWindowManager1.Windows.Add(newWindow)

RadWindowManager1.VisibleStatusbar =

False

 

End If

If e.CommandName = "lnkedit" Then

 

Dim dataItem As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)

Session(

"hidd") = Convert.ToInt16(dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)("product_id"))

 

 

 

 

 

End If

If e.CommandName = "MoveSelected" Then

For Each item As Telerik.Web.UI.GridItem In RadProduct.SelectedItems

 

Dim editLink As LinkButton = DirectCast(e.Item.FindControl("lnkmove"), LinkButton)

Dim Product_Id As Int16 = item.OwnerTableView.DataKeyValues(item.ItemIndex)("product_id")

 

Dim lnkbtn As LinkButton = CType(e.Item.FindControl("lnkmove"), LinkButton)

objproductProperty.ProductId = Product_Id

lblproductId.Text = Product_Id

Dim lnkpartNo As LinkButton = DirectCast(item.FindControl("lnkpartNo"), LinkButton)

lblpartno.Text = lnkpartNo.Text

Dim lblProductName As Label = DirectCast(item.FindControl("lblProductName"), Label)

lblproductdesc.Text = lblProductName.Text

lblvendorname.Text =

DirectCast(item.FindControl("lblSuplier"), Label).Text

 

lblSupplierInternalId.Text =

DirectCast(item.FindControl("lblSupInternalId"), Label).Text

 

objproductProperty.UserId = User.Identity.Name

Dim strDocuments As New StringBuilder

objProduct.FectchAllopenDocuments(objproductProperty, strDocuments)

Dim aa As String = strDocuments.ToString

If strDocuments.ToString <> "" Then

lblMessage.Text =

"<center><b><span class='topCurrent' >This product is included in the following documents ,Are you sure to move ? <BR> </center>" & strDocuments.ToString & " </span></b>"

ModalPopupExtender.Show()

Else

LoadMoveRadWindow()

End If

 

 

Next

 

End If

End Sub

Protected Sub RadProduct_InsertCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadProduct.InsertCommand

'Dim insertedItem As Telerik.Web.UI.GridEditableItem = CType(e.Item, Telerik.Web.UI.GridEditableItem)

'Dim insertedValues As Hashtable = New Hashtable

'e.Item.OwnerTableView.ExtractValuesFromItem(insertedValues, insertedItem)

'Dim entry As DictionaryEntry

'For Each entry In insertedValues

' Select Case entry.Key

' Case "product_name"

' objproductProperty.productName = entry.Value

' Case "PART_NO"

' objproductProperty.PartNo = entry.Value

' End Select

 

'Next

'Dim list As DropDownList = insertedItem.FindControl("List1")

'objproductProperty.ProductTypeId = list.SelectedValue

'list = insertedItem.FindControl("lstSuppliers")

'objproductProperty.SupplierIntId = list.SelectedValue

'list = insertedItem.FindControl("lstUnitType")

'objproductProperty.UnitTypeId = list.SelectedValue

'Dim txt As TextBox = insertedItem.FindControl("Txtnotes")

'objproductProperty.ProductNotes = txt.Text

'objproductProperty.ProductImageLink = "noname.gif"

'objProduct.InsertProduct(objproductProperty, -11)

Dim MyuserControl As UserControl = CType(e.Item.FindControl(Telerik.Web.UI.GridEditFormItem.EditFormUserControlID), UserControl)

FillAllValues(MyuserControl)

objProduct.InsertProduct(objproductProperty, -11)

RadProduct.Rebind()

 

 

End Sub

Protected Sub RadProduct_DetailTableDataBind(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDetailTableDataBindEventArgs) Handles RadProduct.DetailTableDataBind

Dim ProductId As String

Dim dataItem As Telerik.Web.UI.GridDataItem = CType(e.DetailTableView.ParentItem, Telerik.Web.UI.GridDataItem)

If (Not e.DetailTableView.GetColumnSafe("Product_Id") Is Nothing) Then

ProductId = dataItem(

"Product_Id").Text

End If

e.DetailTableView.DataSource = objproductSupplierRelation.LoadBySupplierType(ProductId)

 

 

 

'e.DetailTableView.DataBind()

End Sub

Private Function FindSelectedItem(ByVal tableView As Telerik.Web.UI.GridTableView) As Telerik.Web.UI.GridDataItem

Dim item1 As Telerik.Web.UI.GridDataItem = Nothing

Dim item2 As Telerik.Web.UI.GridItem

For Each item2 In tableView.Items

If (item2.Selected AndAlso TypeOf item2 Is Telerik.Web.UI.GridDataItem) Then

Return CType(item2, Telerik.Web.UI.GridDataItem)

End If

Next

Return item1

End Function

Protected Sub RadProduct_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadProduct.NeedDataSource

Dim ds As New DataSet

If e.RebindReason = Telerik.Web.UI.GridRebindReason.InitialLoad Then

ds = objproductSupplierRelation.FetchAll()

RadProduct.DataSource = ds

 

Else

RadProduct.DataSource = objproductSupplierRelation.FetchAll()

End If

 

 

End Sub

 

 

 

 

Protected Sub RadProduct_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadProduct.UpdateCommand

Dim MyUserControl As UserControl = CType(e.Item.FindControl(Telerik.Web.UI.GridEditFormItem.EditFormUserControlID), UserControl)

Dim editedItem As Telerik.Web.UI.GridEditableItem = CType(e.Item, Telerik.Web.UI.GridEditableItem)

'Locate the changed row in the DataSource

Dim intProdId As String

If e.CommandName = "Update" Then

intProdId = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)(

"product_id").ToString

 

 

 

 

End If

 

FillAllValues(MyUserControl)

objProduct.InsertProduct(objproductProperty, intProdId)

 

 

 

End Sub

Sub FillAllValues(ByVal MyuserControl As UserControl)

objproductProperty.PartNo =

CType(MyuserControl.FindControl("txtPartNo"), TextBox).Text

objproductProperty.productName =

CType(MyuserControl.FindControl("txtProdName"), TextBox).Text

objproductProperty.ProductDesc =

CType(MyuserControl.FindControl("txtDescription"), TextBox).Text

objproductProperty.ProductTypeId =

CType(MyuserControl.FindControl("cmbProductType"), Telerik.Web.UI.RadComboBox).SelectedValue

objproductProperty.SupplierIntId =

CType(MyuserControl.FindControl("cmbManfact"), Telerik.Web.UI.RadComboBox).SelectedValue

objproductProperty.UnitTypeId =

CType(MyuserControl.FindControl("cmbUnitType"), Telerik.Web.UI.RadComboBox).SelectedValue

objproductProperty.UnitPrice =

CType(MyuserControl.FindControl("txtUnitPrice"), TextBox).Text

objproductProperty.ServiceCharge =

CType(MyuserControl.FindControl("txtServiceCharge"), TextBox).Text

If CType(MyuserControl.FindControl("chkMisc"), CheckBox).Checked = True Then

objproductProperty.Miscellanious =

"y"

Else

objproductProperty.Miscellanious =

"n"

End If

objproductProperty.ProductNotes =

CType(MyuserControl.FindControl("txtDescription"), TextBox).Text

objproductProperty.ProductImageLink =

"noname.gif"

 

 

 

 

End Sub

 

Sub FillAllValuesVendor(ByVal MyuserControl As UserControl)

objSupplierProperty.SupplierType = 2

objSupplierProperty.SupplierId =

CType(MyuserControl.FindControl("txtVendorCode"), TextBox).Text

objSupplierProperty.SupplierName =

CType(MyuserControl.FindControl("txtVendorName"), TextBox).Text

objSupplierAddressProperty.Address1 =

CType(MyuserControl.FindControl("txtVendorAddress1"), TextBox).Text

objSupplierAddressProperty.City =

CType(MyuserControl.FindControl("txtVendorCity"), TextBox).Text

objSupplierAddressProperty.Address2 =

CType(MyuserControl.FindControl("txtVendorAddress2"), TextBox).Text

objSupplierAddressProperty.Country =

CType(MyuserControl.FindControl("cmbVendorCountry"), DropDownList).SelectedItem.Value

objSupplierAddressProperty.State =

CType(MyuserControl.FindControl("cmbSiteState"), DropDownList).SelectedItem.Value

objSupplierAddressProperty.Zipcode =

CType(MyuserControl.FindControl("txtVendorZip"), TextBox).Text

objSupplierAddressProperty.Telephone =

CType(MyuserControl.FindControl("txtVendorPhone"), TextBox).Text

objSupplierAddressProperty.FaxNum =

CType(MyuserControl.FindControl("txtVendorFax"), TextBox).Text

objSupplierProperty.SupplierNote =

CType(MyuserControl.FindControl("txtVendorNotes"), TextBox).Text

objSupplierAddressProperty.Title =

CType(MyuserControl.FindControl("txtVendorContactPerson"), TextBox).Text

objSupplierAddressProperty.Title =

CType(MyuserControl.FindControl("txtVendorContactJobTitle"), TextBox).Text

objSupplierContactProperty.ContactPhone =

CType(MyuserControl.FindControl("txtVendorContactPhone"), TextBox).Text

objSupplierContactProperty.ContactMobile =

CType(MyuserControl.FindControl("txtVendorContactMobile"), TextBox).Text

objSupplierContactProperty.ContactEmail =

CType(MyuserControl.FindControl("txtVendorContactEmail"), TextBox).Text

End Sub

 

 

 

 

 

 

 

Protected Sub RadRelationMenu_ItemClick(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMenuEventArgs) Handles RadRelationMenu.ItemClick

Dim radGridClickedRowIndex As Integer

radGridClickedRowIndex = Convert.ToInt32(Request.Form(

"radGridClickedRowIndex"))

Dim strScript As String

Dim SUP_INTERNAL_ID As Int16 = 2

Select Case e.Item.Text

'Case "Add to Favorate"

' strScript = "<script language=javascript>"

' strScript += "openWin('" & SUP_INTERNAL_ID & "');"

' strScript += "<"

' strScript += "/script>"

' Page.RegisterStartupScript("MSGE", strScript)

 

 

 

 

End Select

End Sub 'RadMenu1_ItemClick

Protected Sub RadProduct_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadProduct.ItemCreated

'Dim sortExpr As New Telerik.Web.UI.GridSortExpression

'sortExpr.FieldName = "OBSOLETE_PROD"

'sortExpr.SortOrder = Telerik.Web.UI.GridSortOrder.Descending

'e.Item.OwnerTableView.SortExpressions.AddSortExpression(sortExpr)

'If e.Item.ItemType = Telerik.Web.UI.GridItemType.SelectedItem Then

 

 

 

'End If

'If e.Item.ItemType = Telerik.Web.UI.GridItemType.CommandItem Then

' DeleteLink = DirectCast(e.Item.FindControl("lnkdelete"), LinkButton)

' If DeleteLink.Text = "UnDelete" Then

' DeleteLink.Text = "Delete"

' End If

' MoveLink = DirectCast(e.Item.FindControl("lnkmove"), LinkButton)

' AddVendorLink = DirectCast(e.Item.FindControl("lnkAddtoVendor"), LinkButton)

' 'AddVendorLink.Enabled = True

' EdititemLink = DirectCast(e.Item.FindControl("btnEditSelected"), LinkButton)

' 'EdititemLink.Enabled = True

' 'EdititemLink.CssClass = "edit"

' PrintLink = DirectCast(e.Item.FindControl("btnprint"), LinkButton)

' 'PrintLink.Enabled = True

 

 

' 'If MoveLink.Enabled = False Then

' ' MoveLink.Enabled = True

' 'End If

' 'If AddVendorLink.Enabled = False Then

' ' AddVendorLink.Enabled = True

' 'End If

'End If

 

 

 

 

 

 

 

 

 

End Sub

Protected Sub FavorateProductGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles FavorateProductGrid.NeedDataSource

Dim listoption As Int16 = 2

FavorateProductGrid.DataSource = objProduct.LoadFavorateProduct(1, User.Identity.Name, 2)

End Sub

 

 

 

Protected Overrides Sub Finalize()

objproductSupplierRelation =

Nothing

objProduct =

Nothing

objproductProperty =

Nothing

objSupplier =

Nothing

objSupplierProperty =

Nothing

objSupplierAddressProperty =

Nothing

objSupplierContactProperty =

Nothing

objContact =

Nothing

 

End Sub

Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

'Me.RadToolTipManager1.TargetControls.Clear()

End Sub

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not Page.IsPostBack Then

 

End If

End Sub

Protected Sub grdVendorProduct_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles grdVendorProduct.NeedDataSource

grdVendorProduct.DataSource = objProduct.LoadVendorProducts()

End Sub

Protected Sub RadProduct_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs) Handles RadProduct.ItemDeleted

If Not e.Exception Is Nothing Then

e.ExceptionHandled =

True

DisplayMessage(

True, "Product " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("Product_Id").ToString() + " cannot be deleted. Reason: " + e.Exception.Message)

Else

DisplayMessage(

False, "Product " + e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("Product_Id").ToString() + " deleted")

End If

End Sub

Private Sub DisplayMessage(ByVal isError As Boolean, ByVal text As String)

Dim label As Label = IIf(isError, Me.Label1, Me.Label2)

label.Text = text

End Sub

Protected Sub RadProduct_DeleteCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles RadProduct.DeleteCommand

objProduct =

New clsProducts

objproductProperty =

New ProductProperty()

Dim editedItem As Telerik.Web.UI.GridEditableItem = CType(e.Item, Telerik.Web.UI.GridEditableItem)

objproductProperty.ProductId = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)(

"product_id").ToString

If DeleteLink.Text = "Undelete" Then

objProduct.DeleteProduct(objproductProperty,

False)

Else

Dim retval As Int16 = objProduct.DeleteProduct(objproductProperty, True)

End If

End Sub

Function ParseImage(ByVal strImageName As String) As String

'Static prev_Flag As Boolean = False

'If Not prev_Flag Then

 

Dim StrImagePath As String = "Upload\product_files\images\"

If (strImageName = "") Then

StrImagePath = StrImagePath &

"photo_no.gif"

Else

'StrImagePath = StrImagePath & strImageName

StrImagePath = StrImagePath & strImageName

End If

ParseImage = StrImagePath

'prev_Flag = True

'End If

End Function

 

 

Protected Sub RadProduct_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs)

objProduct =

New clsProducts

If TypeOf e.Item Is Telerik.Web.UI.GridDataItem Then

' If e.Item.ItemType <> Telerik.Web.UI.GridItemType.NestedView Then

Dim nProdId As Integer

Dim lblstockhead As Label

Dim lblStock As Label

Dim dataItem As Telerik.Web.UI.GridDataItem = CType(e.Item, Telerik.Web.UI.GridDataItem)

nProdId = Convert.ToInt16(dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)(

"product_id"))

lblstockhead =

DirectCast(e.Item.FindControl("lblstockhead"), Label)

'= CType(dataItem.OwnerTableView.DataKeyValues(dataItem.ItemIndex)("lblstockhead"), Label)

lblStock =

DirectCast(e.Item.FindControl("lblStock"), Label)

If lblStock.Text = 0 Then

lblstockhead.Text =

"No Stock"

lblStock.Visible =

False

Else

lblstockhead.Text =

"Stock"

 

 

End If

 

 

 

If objProduct.CheckIsObsoluted(nProdId) Then

'lnkUnDelete.Visible = True

e.Item.BackColor = Drawing.Color.LightPink

'Else

' lnkUnDelete.Visible = False

End If

Dim productId As Int16

 

 

Dim lnkbnt As LinkButton

Dim RadToolTipManager1 As New Telerik.Web.UI.RadToolTipManager

lnkbnt =

CType(e.Item.FindControl("lnkeditstock"), LinkButton)

' RadToolTip3.TargetControlID = lnkbnt.ClientID

' RadToolTip3.IsClientID = True

RadToolTipManager1 =

CType(e.Item.FindControl("RadToolTipManager1"), Telerik.Web.UI.RadToolTipManager)

RadToolTipManager1.TargetControls.Add(lnkbnt.ClientID, nProdId,

True)

End If

'End If

End Sub

Protected Sub CancelButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CancelButton.Click

ModalPopupExtender.Hide()

 

End Sub

Protected Sub YesButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles YesButton.Click

LoadMoveRadWindow()

End Sub

 

Sub LoadMoveRadWindow()

Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow

newWindow.ID =

"RadWindow1"

newWindow.NavigateUrl =

"MoveProduct.aspx?ProductId= " & lblproductId.Text & "&PartNo= " _

& lblpartno.Text &

"&lblProductName=" & lblproductdesc.Text & "&Supplier_Name=" _

& lblvendorname.Text &

"&lblSupplierInternalId=" & lblSupplierInternalId.Text

newWindow.VisibleOnPageLoad =

True

newWindow.ReloadOnShow =

True

newWindow.Modal =

True

RadWindowManager1.Windows.Add(newWindow)

RadWindowManager1.VisibleStatusbar =

False

End Sub

Protected Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As Telerik.Web.UI.ToolTipUpdateEventArgs)

Dim ctrl As Control = Page.LoadControl("StockAdd.ascx")

Dim gridItem As Telerik.Web.UI.GridItem

Dim txtstock As Telerik.Web.UI.RadNumericTextBox

args.UpdatePanel.ContentTemplateContainer.Controls.Add(ctrl)

Dim details As StockAdd = DirectCast(ctrl, StockAdd)

CType(details.FindControl("product_Id"), HiddenField).Value = args.Value

End Sub

 

 

 

 

 

'Protected Sub RadProduct_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadProduct.PreRender

' If Not IsPostBack Then

' ' Me.RadProduct.MasterTableView.Items(1).Edit = True

' Me.RadProduct.MasterTableView.Rebind()

' End If

'End Sub

'Protected Sub RadProduct_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadProduct.PreRender

' RadProduct.Rebind()

 

'End Sub

'Protected Overloads Overrides Sub RaisePostBackEvent(ByVal source As IPostBackEventHandler, ByVal eventArgument As String)

' MyBase.RaisePostBackEvent(source, eventArgument)

' If Me.RadProduct.Equals(source) AndAlso eventArgument.IndexOf("DetailTableUpdated") <> -1 Then

' Dim index As Integer = -1

' Dim keyValue As String = eventArgument.Substring(19)

' For Each item As Telerik.Web.UI.GridDataItem In RadProduct.MasterTableView.Items

' Dim keyValues As String = item.KeyValues

' If keyValues.IndexOf("Product_Id") <> -1 AndAlso keyValues.Substring(13, keyValues.Length - 15).Equals(keyValue) Then

' index = item.ItemIndex

' Exit For

' End If

' Next

' If index <> -1 Then

' Dim nestedTableView As Telerik.Web.UI.GridTableView = (TryCast(RadProduct.MasterTableView.Items(index), Telerik.Web.UI.GridDataItem)).ChildItem.NestedTableViews(0)

' nestedTableView.Rebind()

' End If

' End If

'End Sub

 

 

 

End

Class

 









0
Priya
Top achievements
Rank 1
answered on 19 Sep 2008, 10:54 AM
Hello my problem is not solved yet.any idea?
0
Henrik
Top achievements
Rank 1
answered on 05 Jan 2010, 10:36 AM

I have a sample project for this problem in pure asp. Im not sure if it helps you but.
It' shows the updatepanel problem.
Read about it here.

http://blogg.pixcode.se/post/Working-with-ajax-tabContainer-and-ajax-updatepanel.aspx

0
Jean-Francois
Top achievements
Rank 1
answered on 07 Oct 2010, 04:47 PM
Telerik never have the answer...

it's sucks!
0
Sebastian
Telerik team
answered on 07 Oct 2010, 05:35 PM
Hi Jean-Francois,

The problem is rather generic and the common reason for it has been explained in the first reply. If the suggested tests were not sufficient to determine the cause of the issue, please isolate a simple working version of your project and send it via regular support ticket. Thus we will do everything possible to provide up-to-point explanation/fix.

Kind regards,
Sebastian
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Priya
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Priya
Top achievements
Rank 1
Henrik
Top achievements
Rank 1
Jean-Francois
Top achievements
Rank 1
Share this question
or