Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
104 views

Hello Team,

I am facing an issue in the Rad Pane.

In my application i have two Rad Pane - Left Pane and the middle pane. Whn i load the page the left pane is collasped and middle pane is displaying. I am keeping some static controls in my left pane. When i click on the left pane title on the left side of the Rad Splitter left Pan with the controls will display. When i done any events on the left pane without clicking on the pane i want to get the focus back to the middle pane.

Right now middle pane is loading and after few second the control will go to the left pane. How i can able to get the focus on the middle pane after done any operations in the left pane.


Thanks & Regards,
Sushanth Mathew  
Svetlina Anati
Telerik team
 answered on 19 Jun 2009
6 answers
287 views

I have tried mulitple ways to load the treeview and I cannot find one way that works.

 

For instance I have tried using this:

 

RadTreeView1.LoadXml(GetTransformedXmlDoc("TreeViewCombined2.xsl", args)); 

 


Where GetTransformedXmlDoc() returns a correct xml document as a string. All it does is give me XML errors and shows me a node that doesn't even exist in the xml string. This is what it tells me: "There is an error in XML document (1, 40)." When I check for the specific error message this is what I get: "<Nodes xmlns=''> was not expected."

Where that node comes from I have no idea. It's not in the xml I am looking at.



I have tried:
RadTreeView1.DataSource = GetTransformedXmlDoc("TreeViewCombined2.xsl", args);  
RadTreeView1.DataBind(); 

Where GetTransformedXmlDoc()  returns an XmlDataSource object. This sort of worked except I couldn't keep the root node from appearing in the treeview and it also screwed up the text properties of the nodes. Below is a sample xml doc in the exact same form as the one I am trying to load. I cannot set the DataTextField="Text" or the TextField="Text" because my root node doesn't contain that attribute. Is there a way around this?

<Nodes> 
  <TreeViewNode ID="1" Text="Node 1" /> 
  <TreeViewNode ID="2" Text="Node 2" /> 
  <TreeViewNode ID="3" Text="Node 3" /> 
  <TreeViewNode ID="4" Text="Node 4">  
    <TreeViewNode ID="5" Text="Node 5" /> 
  </TreeViewNode> 
  <TreeViewNode ID="6" Text="Node 6" /> 
</Nodes> 


I would appreciate any help as I have wasted the better part of 2 days trying to get this thing to load correctly.
Victor
Telerik team
 answered on 19 Jun 2009
8 answers
267 views
When i press Enter in Textbox txtHistory2 so update data
My mind is: I do not want to press enter in the textbox txtHistory2 the event update. I just want people to click on button Update to update data
<EditFormSettings EditFormType="Template"
                    <FormTemplate >                     
                        <table cellspacing="1" cellpadding="1" Width="100%" border="0"
                            <tr> 
                                <td> 
                                </td> 
                                <td> 
                                </td> 
                            </tr> 
                            <tr> 
                                <td width="100"
                                    Description</td> 
                                <td> 
                                    <asp:TextBox ID="txtHistory2" runat="server" Rows="10" SkinID="TextHistory" Text='<%#Bind("HistoryText")%>' 
                                        TextMode="MultiLine" ValidationGroup="Gro_History_GV" ></asp:TextBox><br /> 
                                    <asp:RegularExpressionValidator ID="txtConclusionValidator_GV" runat="server" ControlToValidate="txtHistory2" 
                                        Display="Dynamic" EnableClientScript="False" SetFocusOnError="True" Text="very long" 
                                        ValidationExpression="^[\s\S]{0,3500}$" ValidationGroup="Gro_History_GV"></asp:RegularExpressionValidator><br /> 
                                </td> 
                            </tr> 
                        </table> 
                        <table style="width: 100%"
                            <tr> 
                                <td align="right" colspan="2"
                                    <asp:Button ID="cmdUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                        runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' ValidationGroup="Gro_History_GV"
                                    </asp:Button>&nbsp; 
                                    <asp:Button ID="cmdClose" Text="Close" runat="server" CausesValidation="False" CommandName="Cancel"
                                    </asp:Button>                                     
                                </td> 
                            </tr> 
                        </table>                         
                    </FormTemplate>                     
                      <PopUpSettings Modal="True" Width="600px"   /> 
                </EditFormSettings> 

Muhammad Zaheeruddin
Top achievements
Rank 1
 answered on 19 Jun 2009
3 answers
203 views
Datum 2&nbsp;<asp:RequiredFieldValidator ID="rfv2" ControlToValidate="RadDatePicker2" runat="server" 
                 ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>   <br /> 
            <telerik:RadDatePicker ID="RadDatePicker2" runat="server" DateInput-InvalidStyle-BackColor="Red"   > 
                <DateInput runat="server" CausesValidation="True" > 
                <InvalidStyle BackColor="Red" /> 
                </DateInput> 
            </telerik:RadDatePicker> 
Hi,
I need RadDatePicker with RequiredFieldValidator. Submitting with no Date shows the errorMessage from RequiredFieldValidator. But I expected to get a red border for DateInput too (InvalidStyle ...). But nothing happens. Whats running wrong?

Heinz
Heinz
Top achievements
Rank 1
 answered on 19 Jun 2009
1 answer
150 views

Hello !

i've got a question about Telerik RadPanelBar control.

For example we've got a RadPanelBar control on form :

        <telerik:RadPanelBar ID="testPanelBar" runat="server">
       
</telerik:RadPanelBar>

and a button which adds a new item to this RadPanelBar at runtime:

        RadPanelItem newParentItem = new RadPanelItem();
       
RadPanelItem newChildItem = new RadPanelItem();
        newChildItem
.Controls.Add(new RadTextBox());
        newChildItem
.Text = "wazzap";
        newParentItem
.Items.Add(newChildItem);
        languagesPanelBar
.Items.Add(newParentItem);

when i click button, new RadPanelItem is added with all child controls(in this case it's RadTextBox in child item)

when button is clicked second time, second RadPanelItem is added with all controls, but this time RadTexBox control dissapeared from first RadPanelItem. 

And same when button is clicked for third time, new item added with all controls, but RadTextBox will dissapear from 1st and 2nd items.

am i doeing something wrong when dynamically adding items ?

Thank You !

Shinu
Top achievements
Rank 2
 answered on 19 Jun 2009
2 answers
130 views
We are using raddocks reading content from database and displaying on webpages, such pages load 5X slower than a normal page.
The docks on your website load fast, Is this an issue with improper implmenting on our code ?

Here's our code. Please let us know how we can improve performance. Thanks, Shubod



DEFAULT.ASPX

<telerik:raddocklayout runat="server" id="RadDockLayout25">
  <telerik:raddockzone runat="server" id="RadDockZone251" FitDocks="true" width="90%" MinHeight="200px" BackColor="Transparent" BorderWidth="1px" BorderStyle="1" BorderColor="Transparent" style="float:left;margin-right:15px; margin-bottom:15px;" HighlightedCssClass="MyHighlight">
   <telerik:raddock runat="server" id="RadDock2511" title="PageContent defined"  text="" Width="100%" EnableEmbeddedSkins="true" Skin="Hay" DockMode="Docked" Resizable="true">
    <contenttemplate>
    </contenttemplate>
   </telerik:raddock>
   <telerik:raddock runat="server" id="RadDock2512" title="Content defined"  text="" Width="100%" EnableEmbeddedSkins="true" Skin="Hay" DockMode="Docked" Resizable="true">
    <contenttemplate>
    </contenttemplate>
   </telerik:raddock>
  </telerik:raddockzone>
 </telerik:raddocklayout>
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DEFAULT.ASPX.VB

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  CMSLibrary.DockContentReader.GetContent(RadDock2512,"Content defined","Newclient",ConString,"../../","stage03.tsunami.aptinet.com")
  CMSLibrary.DockContentReader.GetPageContent(RadDock2511,"PageContent defined","Newclient",ConString)
End Sub
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LIBRARY.VB

    Public Shared Sub GetPageContent(ByRef PlaceContentTo As RadDock, ByVal DockName As String, ByVal ClientName As String, ByVal ConString As String)
        Dim Odb As New CMSDatabase(ConString)
        Dim lblContent As New Label
        Dim StructureID As String = Odb.ExecuteScaler("SELECT DockDataID FROM [" & ClientName & "].[dbo].[DockContentData] WHERE [DockContentName] like '" & DockName & "' and Type = " & DockType.PageContent)
        Dim PageDockContent As String = Odb.ExecuteScaler("SELECT ISNULL([InnerHTML], '') FROM [" & ClientName & "].[dbo].Content WHERE [StructureId] = " & StructureID)
        lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.PageContent.ToString
        lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
        'lblContent.Width = Unit.Percentage(100)
        lblContent.Style("padding") = "10px"
        If Not PageDockContent Is Nothing Then
            lblContent.ID = lblContent.ID & StructureID
            PageDockContent = Text.RegularExpressions.Regex.Replace(PageDockContent, "\[DockPlaceHolder[^\]]+?]", "")
            lblContent.Text = PageDockContent
        Else
            lblContent.ID = lblContent.ID & "0"
            lblContent.Text = " "
        End If
        PlaceContentTo.ContentContainer.Controls.Add(lblContent)
    End Sub
..........................................................................................................................................................................................................................................................................................................................................................................................

    Public Shared Sub GetContent(ByRef PlaceContentTo As RadDock, ByVal DockName As String, ByVal ClientName As String, ByVal ConString As String, ByVal PagePosition As String, ByVal WebsiteURL As String)
        Dim Odb As New CMSDatabase(ConString)
        Dim lblContent As Label
        Dim SqlString As String = ""
        Dim odt As DataTable
        Dim odr As DataRow

        SqlString = "SELECT CD.ContentDocksID, CD.Description FROM DockContentData AS DC INNER JOIN ContentDocksData AS CD ON DC.DockDataID = CD.ContentDocksID WHERE DC.DockContentName like '" & DockName & "' and DC.Type = " & DockType.Content & " and CD.Status = " & DockContentStatus.Enabled & " and CD.Show = " & DockContentShow.Yes & " order by CD.Created desc"

        'SqlString = "select ContentDocksID, Title, description from [" & ClientName & "].[dbo].ContentDocksData where (convert(datetime,convert(varchar(12),Expiry)) >= convert(datetime,convert(varchar(12), getdate())) or convert(datetime,convert(varchar(12),Expiry))='1900-01-01 00:00:00.000') "
        'SqlString &= " and Status=" & DockContentStatus.Enabled & " and Show=" & DockContentShow.Yes & " order by Created desc"

        If Odb.IsExist(SqlString) Then
            odt = Odb.GetDataTable(SqlString)
            For Each odr In odt.Rows
                Dim GetFullPageDockContent As String = Trim("" & odr.Item("Description"))
                If GetFullPageDockContent <> "" Then
                    'GetFullPageDockContent = Replace(GetFullPageDockContent, "../UserControls/Handler.ashx?path=" & ClientName & "/", PagePosition, , , CompareMethod.Text)
                    GetFullPageDockContent = Replace(GetFullPageDockContent, "../UserControls/Handler.ashx?path=" & ClientName, "http://" & WebsiteURL, , , CompareMethod.Text)
                    lblContent = New Label
                    lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.Content.ToString & "_" & odr.Item("ContentDocksID")
                    lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
                    'lblContent.Width = Unit.Percentage(98)
                    lblContent.Style.Add("padding", "10px")
                    lblContent.Text = GetFullPageDockContent
                    PlaceContentTo.ContentContainer.Controls.Add(lblContent)
                End If
            Next
        Else
            lblContent = New Label
            lblContent.ID = "DockText_" & PlaceContentTo.ID & "_" & DockType.Content.ToString & "_0"
            lblContent.Attributes.Add("name", Replace(Replace(DockName, "_", "__"), " ", "_"))
            'lblContent.Width = Unit.Percentage(98)
            lblContent.Style.Add("padding", "10px")
            lblContent.Text = " "
            PlaceContentTo.ContentContainer.Controls.Add(lblContent)
        End If
    End Sub

Petko
Telerik team
 answered on 19 Jun 2009
4 answers
105 views

When I use a RadTimePicker in a table, the text after the RadTimePicker will wrap.  How can I prevent the text from wrapping?


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server" /> 
        <table border="1">  
            <tr> 
                <td>Time: </td> 
                <td style="white-space:nowrap;"><telerik:RadTimePicker runat="server" ID="TimePicker" /> Some random text.</td> 
            </tr> 
        </table> 
    </form> 
</body> 
</html> 

Paul.

Paul
Top achievements
Rank 2
 answered on 19 Jun 2009
1 answer
232 views
I have created a RadGrid with 4 columns and grouping enabled.  The last two columns have a width specified using the ItemStyle-Width property.  When the grid renders the width's are not honored and end up drawing wider than the specified width.  Using the IE development toolbar I found the <p> tag that renders in the GridGroupHeaderItem and set the css attribute display:none.  As soon as I do that the widths are rendered correctly.

There appears to be an issue with having a <p> tag inside of the <td> tag of the group header row.  However, I do not know how to prevent this <p> tag from rendering.

I am using the default skin and 2009.1.402.35 version of the controls.
<rad:RadGrid ID="rgBuySell" runat="server" Width="100%" AutoGenerateColumns="false" onitemdatabound="rgBuySell_ItemDataBound" onneeddatasource="rgBuySell_NeedDataSource" onitemcommand="rgBuySell_ItemCommand" onprerender="rgBuySell_PreRender">  
    <MasterTableView ShowGroupFooter="true" DataKeyNames="fkAssetFrom">  
        <Columns> 
            <rad:GridBoundColumn DataField="ProductToName" HeaderText="Product" UniqueName="Product" /> 
            <rad:GridBoundColumn DataField="ProductToTicker" HeaderText="Ticker" /> 
            <rad:GridBoundColumn DataField="Percent" HeaderText="Percent" ItemStyle-Width="55px" HeaderStyle-Width="55px" /> 
            <rad:GridBoundColumn DataField="Amount" HeaderText="Amount" ItemStyle-Width="55px" HeaderStyle-Width="55px" /> 
        </Columns> 
    </MasterTableView> 
</rad:RadGrid> 
Dimo
Telerik team
 answered on 19 Jun 2009
1 answer
118 views
When is this product going to come out. i'm looking foward to the radlistbox control. being able to move item up, down, sort etc is going to be pretty need. One more question is that will i be able to upgrade to q2 if i just purchased q1 on monday?

Developer License with Subscription and Priority Support this is the one i bought but i'm not sure if i will be able to get major upgrade. please let me know. thanks
Ivo
Telerik team
 answered on 19 Jun 2009
1 answer
174 views

The tooltip works but its not displaying any dynamic data.   i converted from csharp to vb.net.  perhaps i messed up something.
let me know if you spot any errors

page with radgrid code_________________

<

 

asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

 

 

<ContentTemplate>

 

 

<telerik:RadToolTipManager ID="RadToolTipManager1" OffsetY="-1" HideEvent=ManualClose

 

 

Width="250" Height="350" runat="server" OnAjaxUpdate="OnAjaxUpdate" RelativeTo="Element"

 

 

Position="MiddleRight">

 

 

</telerik:RadToolTipManager>

 

 

<div class="title">For Sale by <br />

 

 

<telerik:RadComboBox ID="RadComboBox1" Runat="server" AutoPostBack="True">

 

 

<Items>

 

 

<telerik:RadComboBoxItem runat="server" Text="By Woodmizer" Value="1" />

 

 

<telerik:RadComboBoxItem runat="server" Text="By Owner" Value="2" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<br />

 

By Group

<br /><telerik:RadComboBox ID="RadComboBox2" AutoPostBack="True" Runat="server">

 

 

<Items>

 

 

<telerik:RadComboBoxItem runat="server" Text="Select All" Value="%" />

 

 

<telerik:RadComboBoxItem runat="server" Text="Manual Feed"

 

 

Value="Manual Feed" />

 

 

<telerik:RadComboBoxItem runat="server" Text="Power Feed" Value="Power Feed" />

 

 

<telerik:RadComboBoxItem runat="server" Text="Hydraulic" Value="Hydraulic" />

 

 

<telerik:RadComboBoxItem runat="server" Text="High Production"

 

 

Value="High Production" />

 

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<br />

 

 

<br />

 

 

<br />

 

 

<telerik:RadGrid ID="RadGrid1" Width="600" runat="server" DataSourceID="SqlDataSource1"

 

 

GridLines="None" OnItemDataBound="RadGrid1_ItemDataBound" AllowPaging="true" OnItemCreated="RadGrid1_ItemCreated"

 

 

AllowSorting="true" PageSize="10" OnItemCommand="RadGrid1_ItemCommand">

 

 

<MasterTableView

 

 

AutoGenerateColumns="False"

 

 

CommandItemDisplay="None"

 

 

CurrentResetPageIndexAction="SetPageIndexToFirst"

 

 

DataKeyNames="ProductID"

 

 

ClientDataKeyNames="ProductID"

 

 

DataSourceID="SqlDataSource1"

 

 

Dir="LTR"

 

 

Frame="Border"

 

 

TableLayout="Auto">

 

 

<Columns>

 

 

<telerik:GridBoundColumn CurrentFilterFunction="NoFilter" DataField="ProductID" Display="false"

 

 

DataType="System.Int32" FilterListOptions="VaryByDataType" ForceExtractValue="None"

 

 

HeaderText="ProductID" ReadOnly="True" SortExpression="ProductID" UniqueName="ProductID">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn HeaderText="Product">

 

 

<ItemTemplate>

 

 

<asp:HyperLink ID="targetControl" runat="server" NavigateUrl="#" Text='<%# Eval("item") %>'></asp:HyperLink>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

<telerik:GridBoundColumn DataField="grp" HeaderText="Group" SortExpression="grp"

 

 

UniqueName="grp">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="manuf_year" DataType="System.Int32"

 

 

HeaderText="Yr." ReadOnly="True" SortExpression="manuf_year"

 

 

UniqueName="manuf_year">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="mill_hours" HeaderText="Hrs."

 

 

SortExpression="mill_hours" UniqueName="mill_hours">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="destination" HeaderText="Location"

 

 

SortExpression="destination" UniqueName="destination">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridBoundColumn DataField="price" DataType="System.Decimal"

 

 

HeaderText="Price" ReadOnly="True" SortExpression="price" DataFormatString="{0:C}"

 

 

UniqueName="price">

 

 

</telerik:GridBoundColumn>

 

 

<telerik:GridTemplateColumn

 

 

UniqueName="TemplateEditColumn">

 

 

<ItemTemplate>

 

 

<asp:HyperLink ID="EditLink" runat="server" Text="View Details"></asp:HyperLink>

 

 

</ItemTemplate>

 

 

</telerik:GridTemplateColumn>

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

</telerik:RadGrid>

 

 

 

<telerik:RadWindowManager ID="RadWindowManager1" runat="server">

 

 

<Windows>

 

 

<telerik:RadWindow ID="UserListDialog" runat="server" Title="Editing record" Height="800px"

 

 

Width="800px" Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" />

 

 

</Windows>

 

 

</telerik:RadWindowManager>

 

 

 

</ContentTemplate>

 

 

</asp:UpdatePanel>

code behind________

 

Protected

 

Sub OnAjaxUpdate(ByVal sender As Object, ByVal args As ToolTipUpdateEventArgs)

 

 

Me.UpdateToolTip(args.Value, args.UpdatePanel)

 

 

End Sub

 

 

 

 

 

Private Sub UpdateToolTip(ByVal elementID As String, ByVal panel As UpdatePanel)

 

 

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

 

panel.ContentTemplateContainer.Controls.Add(ctrl)

 

Dim details As ProductDetails = DirectCast(ctrl, ProductDetails)

 

details.ProductID = elementID

 

End Sub

 

 

 

 

 

Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs)

 

 

If TypeOf e.Item Is GridDataItem Then

 

 

 

 

 

Dim editLink As HyperLink = DirectCast(e.Item.FindControl("EditLink"), HyperLink)

 

editLink.Attributes(

"href") = "#"

 

 

 

 

editLink.Attributes(

"onclick") = [String].Format("return ShowEditForm('{0}','{1}');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("ProductID"), e.Item.ItemIndex)

 

 

End If

 

 

 

 

 

End Sub

 

 

 

 

 

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs)

 

 

If e.Item.ItemType = GridItemType.Item OrElse e.Item.ItemType = GridItemType.AlternatingItem Then

 

 

 

 

 

Dim target As Control = e.Item.FindControl("targetControl")

 

 

If Not [Object].Equals(target, Nothing) Then

 

 

 

 

 

If Not [Object].Equals(Me.RadToolTipManager1, Nothing) Then

 

 

 

 

 

Dim currentRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView)

 

 

Me.RadToolTipManager1.TargetControls.Add(target.ClientID, currentRow.Row("ProductID").ToString(), True)

 

 

End If

 

 

 

 

 

End If

 

 

 

 

 

End If

 

 

 

 

 

End Sub

 

 

 

 

 

Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs)

 

 

If e.CommandName = "Sort" OrElse e.CommandName = "Page" Then

 

 

 

 

RadToolTipManager1.TargetControls.Clear()

 

End If

 

 

 

 

 

End Sub

 

 

 

_____________________________________________________________________

ProductDetails.ascx__________________

 

<%

@ Control Language="vb" AutoEventWireup="false" CodeBehind="ProductDetails.ascx.vb" Inherits="UsedMills.ProductDetails" %>

 

 

 

<

 

table runat="server" style="width: 100%" id="ProductWrapper" border="0" cellpadding="2"

 

 

 

 

 

cellspacing="0">

 

 

 

 

 

<tr>

 

 

 

 

 

<td style="text-align: center;">

 

 

 

 

 

<asp:FormView ID="ProductsView" DataSourceID="ProductDataSource" DataKeyNames="ProductID"

 

 

 

 

 

runat="server" OnDataBound="ProductsView_DataBound">

 

 

 

 

 

<ItemTemplate>

 

 

 

 

 

<asp:Label ID="Category" runat="server"><%#Eval("ITEM")%></asp:Label>

 

 

 

 

 

<hr />

 

 

 

 

 

<asp:Image ID="image" Width="200" Height="200" runat="server" ImageUrl='<%# Eval("ProductID", "../../../Img/Northwind/Products/{0}") %>' />

 

 

 

 

 

<br />

 

 

 

 

 

<span >Units On Order:</span>

 

 

 

 

 

<asp:Label ID="Label4" runat="server"><%#Eval("description")%></asp:Label>

 

 

 

 

 

</ItemTemplate>

 

 

 

 

 

</asp:FormView>

 

 

 

 

 

</td>

 

 

 

 

 

</tr>

 

</

 

table>

 

<

 

asp:SqlDataSource ID="ProductDataSource" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:wmConnectionString %>"

 

 

SelectCommand="wmUMSaleBySearchID" SelectCommandType="StoredProcedure">

 

 

 

 

 

<SelectParameters>

 

 

 

 

 

<asp:Parameter Name="ProductID" Type="Int32" />

 

 

 

 

 

</SelectParameters>

 

</

 

asp:SqlDataSource>

 

 

 


____________________________________________________________________________

code behind____________________

 

 

 

 

 

Public Property ProductID() As String

 

 

 

 

 

 

 

 

 

 

Public

 

Property ProductID() As String

 

 

 

 

 

 

Get

 

 

 

 

 

 

If ViewState("ProductID") Is Nothing Then

 

 

 

 

 

 

Return ""

 

 

 

 

 

 

End If

 

 

 

 

 

 

Return DirectCast(ViewState("ProductID"), String)

 

 

End Get

 

 

 

 

 

 

Set(ByVal value As String)

 

 

ViewState(

"ProductID") = value

 

 

End Set

 

 

 

 

 

 

End Property

 

 

 

 

 

 

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

 

 

Me.ProductDataSource.SelectParameters("ProductID").DefaultValue = Me.ProductID

 

 

Me.DataBind()

 

 

End Sub

 

 

 

 

 

 

 

Protected Sub ProductsView_DataBound(ByVal sender As Object, ByVal e As EventArgs)

 

 

Dim image As System.Web.UI.WebControls.Image = DirectCast(ProductsView.FindControl("image"), System.Web.UI.WebControls.Image)

 

 

If image Is Nothing Then

 

 

 

 

 

 

Exit Sub

 

 

 

 

 

 

End If

 

 

 

 

 

 

If Not File.Exists(MapPath(image.ImageUrl)) Then

 

 

 

 

 

image.ImageUrl =

"../../Img/Northwind/Products/noimage.jpg"

 

 

 

 

 

 

End If

 

 

 

 

 

 

End Sub

 

 

End

 

Class

 

 

 

 

 









 

Sebastian
Telerik team
 answered on 19 Jun 2009
Narrow your results
Selected tags
Tags
+? more
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Simon
Top achievements
Rank 2
Iron
Iron
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?