Class 'System.Web.UI.WebControls.TableRow' Cannot Be Indexed Because It Has No Default Property.
Mar 11, 2011
What i am having trouble doing is set the current parameter to the current row at a specific column like e.row[column index]
For Each trow As TableRow In table.Rows
cmd1.CommandText = "dbo.directway"
cmd1.CommandType = CommandType.StoredProcedure
cmd1.Connection = conn [code]....
Class 'System.Web.UI.WebControls.TableRow' cannot be indexed because it has no default property.
First time using a dataset instead of a data reader, and I'm trying to fill both a datalist on my page, and set the selected item value for a drop down list. The datalist on the page is displaying properly, but I get this errorClass 'System.Data.SqlClient.SqlDataAdapter' cannot be indexed because it has no default property. when trying to set the selected value for the drop down list. Why can't I get the selected value for the drop down list to work properly?
I have built a site and worked fine for me, when I passed to a collegaue to deploy into another site he gets the message in subject.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then If Not getQueryString("post") = 0 Then postID = Request.QueryString("post") BlogAdmin1.Buttontext = "Edit Blog" Dim MyCommand As SqlCommand Dim myAdapter As SqlDataAdapter Dim ds As DataSet = New DataSet Dim myUpdateconnection As SqlConnection = New SqlConnection(System.Configuration.ConfigurationManager.AppSettings("conn")) MyCommand = New SqlCommand("ADMIN_BLOG_SELECT_POSTBYID", myUpdateconnection) MyCommand.CommandType = CommandType.StoredProcedure MyCommand.Parameters.Add(New SqlParameter("@postID", SqlDbType.Int)) MyCommand.Parameters("@postID").Value = postID MyCommand.Connection.Open() Try myAdapter = New SqlDataAdapter(MyCommand) myAdapter.Fill(ds, "postData") Catch exp As SqlException Response.Write(exp.ToString()) End Try If Not ds Is Nothing AndAlso Not ds.Tables(0) Is Nothing AndAlso ds.Tables(0).Rows.Count > 0 Then BlogAdmin1.BlogTitle = nullToStr(ds.Tables(0)(0)("title")) BlogAdmin1.BlogBody = nullToStr(ds.Tables(0)(0)("body")) BlogAdmin1.BlogCategory = nullToInt(ds.Tables(0)(0)("category")) End If MyCommand.Connection.Close() LoadData() Else Response.Redirect("/admin/blogs.aspx", False) End If End If End Sub
I tried translating this from vb but getting the error on e.Row.DataItem("CustomerID").ToString i tried varios things but no gooddbSrc.SelectCommand = "SELECT * FROM Orders WHERE CustomerID = '" + e.Row.DataItem("CustomerID").ToString + "' ORDER BY OrderDate";
When I move some web-based code from VS2008 to VS2010, I find it is different when it is hard to handle the Image class.
Let's take the following code as an example.
As I have already imported the System.Drawing namespace, I still cannot use Image.FromFile method as VS2010 detectss the Image class is in System.Web.UI.WebControls namespace.I have lots of such a kind of code in my project using Image class and I will get messed if need to modify the code from
i am usingVWD 2010 andwant to create a website supported under .net 3.5. The deafault mater page has the loging pgaes already set up (.net 4.0) which is very good and helping to start. But once i changed my project to run under .Net 3.5 , i could not have the account register webpage working and getting this error : Parser Error Message: Type 'System.Web.UI.WebControls.CreateUserWizard' does not have a public property named 'LayoutTemplate'.
I'm working on a .NET 3.5 web application which shows/hides table rows contained in ascx files via an interface implementation (the controls containing the table implement the interface).So, given this markup in the .ascx:
Protected Sub FormView1_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.FormViewCommandEventArgs) Handles FormView1.ItemCreated Causes Unable to cast object of type 'System.EventArgs' to type 'System.Web.UI.WebControls.FormViewCommandEventArgs'.
The program (asp.net/vb) works fine with FormView1_ItemCommand and FormView1_ItemInserted events but strangely objects to FormView1_ItemCreated. Is it only a VC# event?
am duplicating a site from a prexisting site. I am getting the error 'System.Web.UI.WebControls.Literal' does not allow child controls when my web application goes to process a function that implements keywords, description, title ect for a webpage. This is quite perplexing as it i not doing this in the website i duplicated from.
it looks at Header, i dont think it can find the definition in this second website so it is returning System.WEB.UI.EmptyControlCollection. In the first website it is returning System.Web.UI.ControlCollection. Also when I go to the definition for Header, it opens up the Metadata definition in the first website. In the Second, it says "Cannot navigate to definition".
'm getting the above error on one server (production of course, it's always production). On two other servers and in my local dev server, the exact same code runs fine. I do see the Display property has ThemableAttribute(false) in the documentation, so the fact that it IS working seems to be the anomoly, but how could this be working in 75% of the environments I'm testing in?
I have a application which uses webparts and 1 control is also a Script Control.So my user controls are derived from System.Web.UI.WebControls.WebParts.WebPart which makes them webpartsI have everything setup and working fine as far as the personalization and webpart goes... every thing displays and works fine.Except that 1 of my control needs to do a bit of work in the OnPreRender event and it turns out that event only gets fired when a user is loged in the application
I've built a class that derives from System.Web.UI.WebControl. It basically renders pagination links (same as what you see on top of GridView when enabled) for use above a repeater.I'm creating some anchor tags explicitly inside my nav control obviously, but they don't perform ajax postbacks. My understanding is that ajax requires POSTS to work right? Well, these would be GETs
my user controls are derived from System.Web.UI.WebControls.WebParts.WebPart which makes them webparts.I have everything setup and working fine as far as the personalization and webpart goes... every thing displays and works fine.Except that 1 of my control needs to do a bit of work in the OnPreRender event and it turns out that event only gets fired when a user is loged in the application.
Protected Overrides Sub OnPreRender(ByVal e As EventArgs) If Not Me.DesignMode Then Me.isloaded = True ' Test for ScriptManager and register if it exists sm = ScriptManager.GetCurrent(Page) [code]...
This is my first "request for help" post - I've spent the past few weeks helping others, so I'm hoping someone can shed some light here.I've dealt with server controls before, so it's not new to me, but it was some time ago and I'm a bit rusty. I have an inherited calendar control, that works fine:
I've overriden the Render method, hoping to be able to modify the HTML output of the control - I want to hide the back arrow if the Month & Year in MinDate is reached in the calendar, and the same goes for MaxDate and the forward arrow.On top of this, I want to be able to display icons in the day cells, under certain data-bound conditions. Once I've figured one out, I'm sure I'll be able to work the other one out.Are there any other methods, events or properties more suitable for this? Are there any other controls that do what I'm looking for that I've maybe overlooked?I'm using C#.Net 4.0 Webforms - it's a very small app, so I've not used MVC etc... just a few LINQ queries to the database.
I'm making the leap to move from vb.net to C#, and I'm getting this crazy error when I try to execute one sp, set a value, and then execute another sp based on the value. proc_GetSectionDetails is my first stored procedure. From that, I get a value for SectionID, and then use it for the second sp called proc_GetSectionDetails