new image/column not working

Last post 06-14-2008 9:38 PM by LockH. 2 replies.

Sort Posts:

  • new image/column not working

    06-11-2008, 1:17 PM
    • Loading...
    • tonian
    • Joined on 04-30-2008, 9:42 PM
    • Posts 29

    previously, i had added an "itemCode" column to the db and got it to work in the site by copy/paste/edit the code for the "description" column in sqlcatalogprovider.vb, item.vb and category.vb and adding the Eval... code to item.aspx and itemdetail.aspx.

    because the 400 images i have for the items are all different sizes/proportions, i can't use the method that comes with the starter kit to just display them at fixed sizes, so i've added larger images for the items and that's what i want to display on the itemdetail.aspx page.  i've used the same process as before, just going through the site where i had added the itemCode code and added in code for the imgLrgUrl column.  but it ain't werkink.

    i get the error below about the GridViewItems.DataBind() in items.aspx.vb.  if i comment back out all the imgLrgUrl related code, it works fine, i just get the small images same as is shown on the items page.

    Any help would be greatly appreciated.

    Section of items.aspx.vb where it stops:

    ' now display the correct panel (categories or items)

    Dim currCategories As List(Of Category) = Catalog.GetChildCategories(categoryId)

    If currCategories.Count = 0 Then

    PanelItems.Visible = True

    PanelCategories.Visible = False

    GridViewItems.DataBind()

    Else

    PanelItems.Visible = False

    PanelCategories.Visible = True

    GridViewCategories.DataBind()

    End If

    Error it throws:

    System.Reflection.TargetInvocationException was unhandled by user code
      Message="Exception has been thrown by the target of an invocation."
      Source="mscorlib"
      StackTrace:
           at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)    at System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance)    at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)    at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)    at System.Web.UI.WebControls.DataBoundControl.PerformSelect()    at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()    at System.Web.UI.WebControls.GridView.DataBind()    at ItemsPage.Page_Load() in C:\Websites\smlbzqsk\Items.aspx.vb:line 75    at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o)    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)    at System.Web.UI.Control.OnLoad(EventArgs e)    at System.Web.UI.Control.LoadRecursive()    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
      InnerException: System.IndexOutOfRangeException
           Message="imgLrgUrl"
           Source="System.Data"
           StackTrace:
                at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String fieldName)    at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)    at System.Data.SqlClient.SqlDataReader.get_Item(String name)    at SqlCatalogProvider.GetChildItems(String parentCategoryId) in C:\Websites\smlbzqsk\App_Code\Catalog\SqlCatalogProvider.vb:line 60    at Catalog.GetChildItems(String categoryId) in C:\Websites\smlbzqsk\App_Code\Catalog\Catalog.vb:line 34
           InnerException:

  • Re: new image/column not working

    06-14-2008, 11:18 AM
    • Loading...
    • tonian
    • Joined on 04-30-2008, 9:42 PM
    • Posts 29

    how about just a comment if it seems like i'm generally doing it right and the problem is likely just some small typo or something.

    or maybe there's a way to debug it i should be using?  i've been through the menus and not found anything i can understand about debugging.  i was looking for a way to see what the actual values were in an array at a particular point but haven't seen that.  is there some such?

    thanks again.

  • Re: new image/column not working

    06-14-2008, 9:38 PM
    • Loading...
    • LockH
    • Joined on 03-25-2007, 10:58 AM
    • Scotland, where whisky has no e.
    • Posts 570

    Somebody might be able to help if you post the gridview and datasource markup and code. And SQL select statement.

    If a post helps to solve your problem, please click the Answer button on that post.

    I'm still confused, but now I'm confused on a higher plane.
Page 1 of 1 (3 items)
Microsoft Communities
Page view counter