.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Oracle Error when Selecting from Gridview that is bound to another Gridview

Posted By:      Posted Date: October 23, 2010    Points: 0   Category :ASP.Net


I've been working on a webform to pull data from an oracle database v10. I can create a gridview1 with Selection enabled and it will populate with data without a problem. However when I create a second gridview and bind with a control to the first gridview, I get the following error at runtime when I click on one of the Selects.

Exception Details: Oracle.DataAccess.Client.OracleException: ORA-00936: missing expression

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[OracleException (0x80004005): ORA-00936: missing expression]
Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck) +1440

View Complete Post

More Related Resource Links

Format Generic List Bound to Gridview


I have a generic list of a custom type. The custom type has a string and double.

I'm binding the list to a gridview and it outputs everything fine.

I'm trying to format the double column into a currency format. It is in a template field as I'm calculating a running total. I pass the value to a function that returns a double and adds the current value to a running total which I will show in the footer.

The format is not changing to currency as expected when using String.Format("{0:c}", GetTotal(Convert.ToDouble(Eval("Amount"))))

Any ideas on what might be going on and how to fix this?


Master-Detail GridView in Single Page example with paging throws error

___http://www.java2s.com/Code/ASP/Data-Binding/MasterDetailGridViewinSinglePage.htmI followed example at the link above.When I enablind paging=true (by pagesize=3).and clicking to pages 2|3|4 etc and so;error occuringIndex was out of range. Must be non-negative and less than the size of the collection.at cs line :sourceProducts.SelectParameters[0].DefaultValue = gridMaster.DataKeys[e.Row.DataItemIndex].Value.ToString();got any idea?what should I make to fix this ? is this error  fixable ?thanks much.

Gridview (bound by ObjectDataSource) Sorting - VB.NET

Hello.. I have a gridview being data bound by an objectdatasource which points to a BLL/DAL.  I have paging and sorting enabled within the gridview. I have the fields configured in the look/fell I want from a templatefield.  This templatefield has the sort expression (date) I want things to be sorted by. All this works as it should and I have no issues with it. But, the issue is that when I click on the header to sort asc/desc by date, I have to click on it twice for it switch to descending order.  E.g.  I hit the webpage and it lists all the information in the gridview, sorted by date, ascending order.  If I want to sort by descending order, I have to click the date header twice in order for the gridview to sort the information in descending order; the clicks cause a post-back and the whole screen is refreshed. Any ideas why this may be occurring?  Thanks.. -Jeff  

Selecting One Radio Button In A GridView

Hello, how do I add a RadioButton column to a gridview so that only one button is selectable? Here is what I have now. <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="false"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:RadioButton ID="RadioButton2" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:HyperLinkField DataTextField="Text" DataNavigateUrlFields="NavigateURL" /> </Columns> </asp:GridView>  

Insert columns into GridView and rendercontrol error

Hi I´m inserting columns into a gridview at run time using: gvRageReport.Columns.Insert(index, column) When I render the gridview in orther to export to excel all the excel columns are empty except the new insert columns, but when I add the new columns using gvRageReport.Columns.Add(column) the excell is exported successfully.Any idea?

Gridview Edit Error

I have a gridview that gets an error when clicking the Edit button on every other row.  the error is "Conversion from string "" to type date is not valide".  Here is the code: Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim current As Date = Date.Now Dim future As Date = Date.Now.AddDays(7) If e.Row.RowState <> DataControlRowState.Edit Then If e.Row.RowType = DataControlRowType.DataRow Then If CDate(e.Row.Cells(3).Text) <= current Then e.Row.BackColor = System.Drawing.Color.Red ElseIf CDate(e.Row.Cells(3).Text) > current And CDate(e.Row.Cells(3).Text) < future Then e.Row.BackColor = System.Drawing.Color.Yellow ' Else : e.Row.BackColor = System.Drawing.Color.White End If End If End If End Sub <asp:GridView ID="GridView1" runat="server" AllowSorting="True" AutoGenerateColumns="False" CellPadding="9" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="Horizontal" DataKeyNames="idx" Font-Size="Small" Width=&q

Gridview control Delete error -- Must declare the scalar variable "@GradeID"

 Hi All,Pardon me if this seems redundant. I have searched the archives and found many references to this type of error. Most (all?) boil down to a mismatch between the token for the databound field and the sql parameter. I have stared at this code for a long time and can see nothing wrong with it. In fact, it is so simple that I started over from scratch using only the designer (ie I wrote no code), so I don't see how it possible to have a name mismatch. I would very much appreciate any help figuring out what is the problem here. Thank you very much in advance.-Roger   Server Error in '/ssp/inet220a06' Application. Must declare the scalar variable "@GradeID". Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@GradeID". Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

GridView bound to SqlDataSource = 2 tier ?


Hi guys,

I've got two questions about n-tier architecture.

I have an aspx page with 2 controls on it - a GridView bound to a SqlDataSource control.
Am I correct in thinking this is 2-tier ?

If I were to replace the SqlDataSource with an ObjectDataSource, and make the database connections/calls/queries via a class in the App_Code folder, this would be 3-tier, right ?

update error of gridview


Hi.. I have a grid view. I had set the autogenerateedit buttion to true. and i wrote the following code

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        GridViewRow row = GridView1.Rows[GridView1.EditIndex]; 
        string str1 = ((TextBox)(row.Cells[1].Controls[0])).Text; string str2 = ((TextBox)(row.Cells[2].Controls[0])).Text; Response.Write(str2 + "                 " + str3); GridView1.DataBind(); }

So, When i click the edit button on the grid view, it will show me 'update' and 'cancel' buttons along with text boxes for cells 1 and 2. but when i change the data in those text boxes and click the 'update' button, 'response.write' is sowing me the previous values rather than modified values. How to get the modified values into str1 and str2 ?

GridView - putting TemplateField fields in between data bound fields


Here is my problem.  I have a GridView, and I want Column1 to be equal to datatable data (filled by a SqlDataAdapter).  Then I have two other fields by the SqlDataAdapter (first name, last name), and I want to have those two fields combined to form Column2.  I have a TemplateField for my GridView that combines the first name and last name with Eval()'s, but the GridView places this combined field TemplateField and puts it as the first column.

How can I do this so that TemplateField can go in between fields that are databound?  Thanks in advance. :)

How to Format Data inside a Bound Column of Gridview?



I have a bound column.

<asp:BoundField DataField="WorkPreference"  HeaderText="WorkPreference"
                    <HeaderStyle HorizontalAlign="Left" />

dr["WorkPreference"] = sa.WorkPreference ( This is how I bind the data  to a DataRow)

The example of the data which gets bound to this column is like the following:

Communications and Marketing Officers; Environmental Assessors; Geologists and Geosciences; Geospatial/Spatial Information Officers;

What I want is that the data should be presented to the user like the following:

Communications and Marketing Officers

Environmental Assessors

Geologists and Geosciences

Geospatial/Spatial Information Officers

In short: I basicaly want to put a break where there is a colon and then bind the data to the gridview.

It looks like simple but if you can let me know. Thanks.

GridView not refreshing in UpdatePanel after selecting LinkButton


I need help with a GridView that appears in an AJAX UpdatePanel. This GridView contains a TemplateField with a LinkButton that displays a text value.  When the link button is clicked, the code behind needs to capture the text value of the button, and then refresh the GridView with an asynchronous postback within the UpdatePanel and display the updated output.

The post-back event is occurring, and I'm able to capture the event in Visual Studio 2010 debugger.  But, the screen contents do not change after this event occurs.  No exception gets thrown, at least from what I can see in debugger.

Portions of the sanitized code appear below.  The GridView actually appears on a page that contains 2 dropdown lists and 2 other GridViews.  There is just one UpdatePanel on this page.

<asp:UpdatePanel runat="server" ID="upMain" ChildrenAsTriggers="false" UpdateMode="Conditional">
        <asp:AsyncPostBackTrigger ControlID="grdProcesses" EventName="RowCommand" />

		<asp:GridView runat="server" ID="grdProcesses" AutoGenerateColumns="false"
		    BorderColor="#7f9db9" BorderStyle="Solid" CssClass="tblBase"

Gridview Search Error


I want to give search functionality in grid view. To implement this i am following the below link


but I am getting following error

The name 'MSCD' does not exist in the current context

Iam using the following code

if (MSCD.Utilities.Validation.IsDateTime(_newValue) == true)


                    DateTime dtValue = DateTime.Parse(_newValue);

                    _newValue = sfield + " " + _operator + " #" + dtValue.ToShortDateString() + "#";


Can anyone tell me why iam getting this error and what is the use of this MSCD.Utilities.Validation sysntax

Selecting radio buttons in a gridview with dataset from Linq Query


Hi Everyone!

I've got a gridview that will allow clients to edit options they've already entered on another page.  The gridview has three radio buttons in it each with a value of 1,2,3.  The option value in the dataset is 1,2 or 3 respectively.  I would like to have the radiobutton with the corresponding value selected in the gridview so they can see what they previously chose and will then be able to edit, if they wish.

How do I do this? 

Here's my code so far:

Dim clientOption = (From c In dc.ClientOptions _
                                 Where c.clientID = userClientID _
                                 Select New With {c.clientOptionID, _
                                                  c.optionWording, _

            'Now Populate Gridview 1 with set options
            If clientOption Is Nothing Then
                Label1.Text = "There are currently no set options to edit."

                GridView1.DataSource = clientOption
                Label1.Text = "Edit set options."
            End If

            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="F

Error when trying to export gridview to Excel - RegisterForEventValidation can only be called during

I have a pretty basic vb.net page that has textbox control on it and a "generate" button that when clicked, fills a datagrid.  That all works great, but when the user clicks the "Export to Excel" button, I get this error.. RegisterForEventValidation can only be called during Render(); 

Here's my code behind, I thought I included everything I needed...

Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
End Sub

Private Sub ExportToExcel(ByVal strFileName As String, ByVal dg As GridView)
        Response.Buffer = True
        Response.ContentType = "application/vnd.ms-excel"
        Response.AddHeader("content-disposition", "attachment;filename=" & strFileName)
        Response.Charset = ""
        Me.EnableViewState = False
        Dim StringWriter As New System.IO.StringWriter()
        Dim HtmlTextWriter As New System.Web.UI.HtmlTextWriter(Str

error when testing query during configuring sql data source for gridview


I got the following error message:

There was an error executing the query. Please check the syntax of hte the command and if present, the types and values of the parameters and ensure they are correct.  Failed to enable constraints.  One or more rows contain values violating non-null, unique, or foreign-key constraints.

But when I run the query through Management Studio, I can get the result. 

There are no parameters for this query either. 

Can anybody give me a glue what to check?


Error : While using Collapsible panel in gridview


Dear All,

i am using a grid view as a child control inside a grid view and using an collapsible panel extender to show and hide the child grid.

here is my code

<asp:Panel ID="Panel1" runat="server">
                            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                    <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; background-color: ButtonFace;
                                        font-family: Arial; font-size: 13px;">
                                            <td align="left" width="7%">
                                                <b>Select Date :</b>
                                            <td align="left" width="15%">
                                                <asp:TextBox ID="txtdate" runat="server"></asp:TextBox>
                                                <img src="Calendar_scheduleHS.png" alt="Select Date" id="calimg&quo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend