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


Post New Web Links

FormView + ObjectDataSource - can't find ControlParameter values

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

I'm trying to use a FormView + ObjectDataSource that uses ControlParameters to do an insert.

I have the following static DAL method which calls my LINQ-to-SQL stored proc:

public static void AddQuestion(string questionText, string expectedAnswer, bool alwaysShow, int interviewTypeID, int skillFamilyID, int questionSubcategoryID, int competencyTypeID)
{
using(ACITDataContext db = new ACITDataContext())
{
try
{
db.usp_AddQuestion(questionText, expectedAnswer,
alwaysShow, interviewTypeID, skillFamilyID,
questionSubcategoryID, competencyTypeID);
}
catch (Exception ex)
{
//LogException(ex);
throw (ex);
}
}
}

And I have this WebForm page (some content removed for brevity):

<asp:FormView ID="frmQuestion" runat="server" DefaultMode="Ins


View Complete Post


More Related Resource Links

ObjectDataSource asp:ControlParameter - textbox is inside Wizard Control - Error "Could not find con

  

I have the following aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestWizard.aspx.cs" Inherits="TestWizard" %>

<!DOCTYPE html

FormView KeepInEditMode=true isn't retaining values

  


I have an "Edit Page" in my application. It uses a FormView bound to an EntityDataSource.

I have a handler setup for the FormView OnItemUpdated event. If an exception occurs (such as foreign key constraints or non date vales entered in a date colum, etc.), then I set the "KeepInEditMode=true". This is SUPPOSED to retain the user entered values on all of the text boxes instead of rebinding the FormView to the data again and clearing those text boxes. (Right?)

Well, it isn't working...

I have stepped through the code via the debugger and the "KeepInEditMode" does get set to true, but as soon as the page reloads, the values revert back to the original database values (the data is being rebound).

I should also mention that I am setting "ExceptionHandled" to true. I am doing this because I am handling the Exception by displaying an error in a specific area of the page and if I dont mark it as handled, IE generates an Exception popup.

Any ideas?
 


How to find the total or all up values in MDX

  

Hi,

i am very new to MDX. Can you please help me to get the allup total for the following MDX query

WITH SET [Top 20 Exams] AS
FILTER(TOPCOUNT([Exams].[Exam Number - Exam Name].members,21,[Measures].[ExamsDelivered]),[Measures].[ExamsDelivered]>0)


SELECT
{[Measures].[ExamsDelivered] }
ON COLUMNS,
subset({[Top 20 Exams]},1)}
ON ROWS


FROM (SELECT <<Time>> ON 0 FROM (SELECT <<Geography>> ON 0 FROM (SELECT <<Channel>> ON 0 FROM (SELECT <<Program>> ON 0 FROM (SELECT <<Technology>> ON 0 FROM (SELECT <<Audience>> ON 0 FROM (SELECT <<ExamVendorClientCode>> ON 0 FROM [MSCERTD_Cube])))))))


Rency

Trying to Retain Values in a FormView When Validations fails or the SQL Fails on an Insert

  

To me this should be much easier, but I can't seem to retain the values that are put in the Insert template upon a validation failure or when the sql fails. This will prevent the user from having to retype everything agin in the event of a failure.

As you can see I am using the Sub Insert_Click and not using an insert through the wizard. so the fields are unbound textboxes on the form. There are 2 dropdowns that provide choices for the other fields.

Any help would be appreciated. I pasted in the code using the text only option becuase the format was getting messed up. I porboably need more background on why the fields are blanking out.

 

 

See Code below

 

 

Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

' Dim sqlparm As String

Dim con As Data.SqlClient.SqlConnection = Nothing

Dim cmd As Data.SqlClient.SqlCommand = Nothing

Dim dr As Data.SqlClient.SqlDataReader = Nothing

Dim sql As String = ""

Dim x As Integer

' Dim x As Integer

'Validation

Try

If CType(Me.fvwAppSecurityDetails.FindControl("CorpIDTextBox"), TextBox).Text = "" Then

Me.lblMessage.Text = "CorpID cannot be blank"

Exit Try

Else : Page.Session("CorpID&

Formview paging not working with objectdatasource and viewstate setup

  

I was able to get the formview bound to the objectdatasource, it works great for the first record, but when i select the next record it gives me error  below is all my code, if there is something else that i need to post please let me know.

 

I opt'd for using formview since it has paging ability.. But now that i got that working, selecting the next record gives me an error.

This is what i have as my button event:

 

        protected void btnSearchHealthRecords_Click(object sender, EventArgs e)
        {
            if (ddlVehNum.SelectedValue == "0")
            {
                rfvVehNum.IsValid = false;
            }
            else
            {
                ObjectDataSource1.SelectMethod = "HealthRecords";
                ObjectDataSource1.SelectParameters.Clear();
                ObjectDataSource1.SelectParameters.Add("vehiclenum", TypeCode.String, ddlVehNum.SelectedValue.ToString());

                ViewState["MethodName"] = "HealthRecords";

                FormView1.Visible = true;
                FormView1.DataBind();

                Session["btClick"] = "5";
                sn.Visible = true;
            }
        }

 

        protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
          

Compute Values in FormView From Row Data

  

Here's what I am trying to do:

Inside Form View Want to display the average of a field based from field1/field2

ie:) 

Field 1 = 10

Field 2 = 5

Field 3 would equal 2 (Field 1 / Field 2)

How would I go abaout doing this.  Code currently looks like:

<asp:Label ID="sales_per_qtr" runat="server" Text='<%# Bind("total_sales/total_qtrs") %>' />

Using custom bind expression in the formview but it won't let me do this...

All input appreciated.

Thanks


Find and compare values from a repating table?

  

Hi all

I am trying to loop through a repeating table, which is a secondary data source, and compare the Title column from the repeating table to another string which is not from the table. If they equal, I want all other rows to be hidden, except the equal one. I could do it easily in regular c#, but have not done it with InfoPath. I am not quite sure how to acheive that in InfoPath. If somebody could give me some sample code to put me in the right direction, I would be most thankful.

Regards.


How to Pass Values Between Web Pages ASP.NET

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

How to Pass Values Between ASP.NET Web Pages

  
You can pass information between pages in various ways, some of which depend on how the redirection occurs. The following options are available even if the source page is in a different ASP.NET Web application from the target page, or if the source page is not an ASP.NET Web page:

Use a query string.

Get HTTP POST information from the source page.

The following options are available only when the source and target pages are in the same ASP.NET Web application.

Use session state.

Create public properties in the source page and access the property values in the target page.

Get control information in the target page from controls in the source page.

jquery autocomplete multiple values

  

i got some samples and i did autocomplete using jquery , its working well for single input values

but i need to pass multiples values after one by one in the textbox. Is it possible to pass multiple

values in the textbox for autocomplete in jquery in asp.net?

 


Formview LinqData source not allowing updates

  

OK, I'm confused.  I've set up a formview with a Linqdata source to allow users to edit records.  When I run it, edit data and submit, it blows up and tells me "Linq datasource6  does not support the Select property when the Delete, Insert or Update operations are enabled."  I googled that warning and saw a couple of posts on this forum saying the problem is the slect statement has to be removed from the Linq data source for it to allow updates. 

But if I remove the select statement then how do I show the user specific info on pageload?   plus I thought the two way databind was an advantge of the datasource control.

 

 

 


JQGrid Loading deleted values

  

Hi,

This is quite strange. here is the issue:

Some Info:

1. I'm using a multi-select jqgrid.

2. I have my own delete button to delete multiple orders

The problem:

When i press the delete button on the pager of my jqgrid, the records are deleted from the database but JqGrid shows some records (4-5). On refreshing the grid, correct numbers of records are shown.


Here is the code:


function delorder() {
        var amg = $("#horder").getGridParam('selarrrow');
        var cont = amg.length;
        if (amg.length > 0) {

find a Control inside a GridView using jQuery

  

I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!


here is the code page: 


<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">
                                <Columns>
                                    <asp:T

How to cast integer values as an array of enum values?

  

Hello all!

I'm working with VS2010 Beta2, ASP.NET and Dynamic Data. I'm using VB but will certainly be happy to receive a C# example if necessary. Laughing

I used a few of Steve's examples (Writing Attributes and Extension Methods for Dynamic Data and Dynamic Data - Hiding Columns in selected PageTemplates) to create a custom property attribute to be applied to a dynamic data column and want it to accept an array of enum values (each value will represent a dynamic data page template where this column should not be displayed).  My new attribute works fine when I hardcode it like this, meaning the HideColumnIn attribute is properly populated with the array of enum values:

<HideColumnIn(PageTemplate.List, PageTemplate.Edit)> _
Public Property My_DD_Column As Object

 

However, I want to store the values to be used for the HideColumnIn in the DB as integer values that correspond to the

Passing values in pages

  

Hi! Friends..

how to pass the value from one page to another page in asp.net  with out Using State Management Concepts?

Like 1. cookies

        2.Session

        3. QueryStrings

     With out using the above should pass the values...


Is there any way to find out the reason for session expiry?

  

Dear All,

is there any way to find out the reason for session expiry?

Regards

Denny


Cannot find ASP.NET tab on IIS6+2003,how to choose .NET framework 4.0?

  

Hi all,

I just wanna setup a .net framework 4.0 on my VPS for a new site. While I could not find the ASP.NET tab on properties. I did some research find some similar problems but haven't fixed it yet.

Any suggestion would helpful.

Thanks.

 


Categories: 
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