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


Top 5 Contributors of the Month
MarieAdela
Imran Ghani
Post New Web Links

Validating form values before insert

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net
 

Before committing the record from the postback of the Create or Edit method in my controller, I validate the values in the form against some business rules in the GetRuleViloations() of this domain object.  The following rule example is written in two ways.  The 1st one validates against the numeric values in form, the 2nd one validates using the associated object (lookup table in database) description via the foreign key.  I would like to use the 2nd method, but during the Create postback the associated object is always null.  

/***** this works for Edit postback but doesn't work for Create postback *****/
if (Reason.HasValue && (Status.HasValue && Status1.Status1.Contains("TBD"


View Complete Post


More Related Resource Links

Loosing Values in Form on Insert Attempt

  

 I have a page with an asp:FormView.  When I attempt an insert and it fails I loose the data in the form.  ViewState is enabled.

<asp:FormView ID="frm_Person" runat="server" DataKeyNames="Person" DataSourceID="ds_edit_Person" DefaultMode="Insert" ViewStateMode="Enabled"> 

I am trapping the error on the datasource with 

<asp:SqlDataSource ID="ds_edit_Person"....

oninserted="ds_Edit_Person_Sql_Event" onupdated="ds_Edit_Person_Sql_Event" ... 

(ErrorHandler is just a static lookup function):

protected void ds_Edit_Person_Sql_Event(object sender, SqlDataSourceStatusEventArgs e) {
        if (e.Exception != null) {
            SqlException sqlex = (SqlException)e.Exception;
            lbl_Error.Text = ErrorHandler.TranslateError(sqlex.Number);
            e.ExceptionHandled = true;
        }
        else {
            lbl_Error.Text = ErrorHandler.TranslateEr

What is the easiest way to reset all the values of controls on a web form (vb.net) to their defaults

  

What is the easiest way to reset all the controls on a web form.  Can I set "veiw state" to false for all of the controls with one command, do a response-redirect to its own page, and set view state back to true.  What is the easiest way to do it.

 

Thanks 


Insert image into Infopath form and save to SharePoint as PDF file

  

I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).

thanks!


--Thiago

hsdsd: how to insert two values from text box1 to gridview g

  

database:a

table a

a                                 b

jhgd                           kljhskjd

sdghdshgd                 jkhdjhdjk

what i need is when enter some values(varchar ) in txt 1 and 2

it should be added in database and shown in gridview1 after i press butt1

 

any bodyknows full code answer/akdj


How to insert values into my table the data is coming from inline table valued function

  
Hi all,   i have table oi want insert values into my table the data is coming from inline table valued function how i can use the inline table valued function to insert datainto my table i have inline function which out puts 3 collumns of data how i can insert this data into my table i have the insert statment like below insert into tablename(c1,c2,c3,c4,c5) select ('abc',....................,'xyz') how i can use the out put put of my inline function to  to insert data into my columns c2,c3,c4. please help me out Thanks & Regards Sunil Yoganna

How do I insert values into different colunms but same row in a table using stored procedure

  
Hi everyone, I wish to create a scenario whereby my Stored Procedure will be able to do an Insert values into two colunms but single row of a table. For instance: AS BEGIN INSERT INTO Table1 (Message1, Number1) VALUES(@Message1, @Number1) END When I do the above stored procedure using SQL Express, and Excecute the stored procedure in VS2005 C# using ADO.Net, the table is updated but the values of Message1 and Number1 are inserted into different rows i.e. when value is inserted into Message1, Number1 is '0' and vice-versa. what I really want is for both Message1 and Number1 to be inserted with values at the same row. How do I acheive this please? Many thanks in advance.

How do I insert values into different colunms but same row in a table using stored procedure

  
Hi everyone, I wish to create a scenario whereby my Stored Procedure will be able to do an Insert values into two colunms but single row of a table. For instance: AS BEGIN INSERT INTO Table1 (Message1, Number1) VALUES(@Message1, @Number1) END When I do the above stored procedure using SQL Express, and Excecute the stored procedure in VS2005 C# using ADO.Net, the table is updated but the values of Message1 and Number1 are inserted into different rows i.e. when value is inserted into Message1, Number1 is '0' and vice-versa. what I really want is for both Message1 and Number1 to be inserted with values at the same row. How do I acheive this please? Many thanks in advance.

Validating Textbox for Numeric Values

  
I want to validate a textbox that only a numeric currency value can be put into it, for example 0.00. I thought the following code was correct but it doesnt seem to wrk, its causing an error on my page and when I remove it the page is fine, it doesn't actually give exact details of the error on the page just says "syntax error" in the browser that is all.<asp:CustomValidator runat="server" ErrorMessage="Please enter a numeric value for Night Rate in the format of 0.00" ID="NightRateNum" ControlToValidate="txtNightRate" Text="*" ClientValidationFunction="^\d+(\.\d\d)?$"></asp:CustomValidator>Would appreciate if any can tell me where I went wrong Thanks

insert mulitple comma seperated values in a temp table

  
I have a reporting services report with a single parameter that can take up to 10 numbers which are comma delimited. I need to insert those numbers into a temp table with one column. So if the numbers were 1 - 10 I would expect to see something like this if querying the temp table Acct_Num 1 2 3 4 5 6 7 8 9 10 Is there a way to do this insert into the table using a comma delimeted string of numbers? ThanksFJK

How to override the style values in a sharepoint workflow task form

  

I've created a aspx task form, and it's working as planned.  However, the window that is popping up when the task form fires is too small, and I would like to set the initial height/width to my own values.  How do I override the standard sharepoint css/style values so that I can control the size of the task window?

thanks


Rocky Sanders

Insert checkboxlist selected values into sql table using createuser wizard

  

Hi,

I am using CreateUserWizard control where I collect personal information from the user on the first step (ie. name, address, tel, mobile etc) then on the second step I collect information for membership service (ie. user name, password, email etc). When user clicks Create button, information is sent to two different tables in the same database. Everything works fine but one.

In the first step where I collect personal information, I also collect details about Interest which is a CheckBoxList (CheckBoxList is getting values from Interests table: 1-White, 2-Green, 3-Brown, 4-Maroon, 5-Yellow).

What I want to do is, when client selects his itnerest categories and clicks Create button, to send selected values from CheckBoxList into the third table called Categories. I want values to be registered into the CatCode column in Interests table as comma delimited. For example: if client selected "White", "Green" and "Yellow", appropriate values for those interests (such as 1, 3, 5) to be registered under Categories table CatCode column (like: 1,3,5).

Following is my code:

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" 
        oncreateduser="CreateU

Deleted Values Insert into a New Table

  
Hi All,

I have Database DB and Table CB ..CB has 3  dependent Tables OB ,CP,CI
So My Requirement is ..

delete  From CB
where ID_NUM not Like '99%'

But here delete will  not work because of FK .. so i need to delete records from OB CP CI Tables first ...and I need to store all the Deleted Records of all the 4 Tables (CB,OB,CP,CI) in a seperate Table
May be all 4 deleted values in a Table
or
each table deleted records in each Seperate newly created table..



all i Know to go each child table and delete but ....It may be time Running Script ...
Or
Individuall for Each delete and Store in new table



Can any one Help me on This .....


Sharepoint 2010 add/edit form: Insert link from sharepoint disabled

  

Hello!

 

I have a list with enhanced rich textbox field. I can click on Insert link, "from addres" is enabled, but "from Sharepoint" is disabled.

Is there a reason why is this button disabled? Field is enhanced rich textbox... Paste button is also disabled.

 

Thanks


Creating a Form say grid sort of a interface where in data values will be extracted from the table 4

  

how dis can be done help please with simple button click and changing the values it can be done but how to move columns with data in graceful manner the way we have in calendar control... 


How to INSERT new row values from two different sources, all fields from a table plus one additional

  
--Loading the single row returned by a table valued function into a temp table works fine like this:
DECLARE @techNumLoop VARCHAR(25)

DECLARE @myTemp TABLE (
 Names Varchar(25)
,Item_Count Integer
,Expense_AP MONEY
--,[...20 more fields]
)
--Loop a while
INSERT @myTemp SELECT * FROM ufn_FindSomeRow(@techNumLoop)
--And finally display a table with one row for each function call
SELECT * FROM @myTemp
============
--My Question: what if I would like to also display the value of @techNumLoop passed in to ufn_FindSomeRow?
--Then I add a field to @myTemp to hold it:
DECLARE @myTemp TABLE (
 TechNum VARCHAR(25)--added

Launch a Repeating Section based on changes in form values

  

Hello,

What I am trying to do is launch a repeating table based on what the user selects from a drop down box. This is a form I am using for Users to test new applications. If this is the first log in attempt there is no need for a 2nd section but if the user chooses 2 or more I would like the form to automatically launch the next section just like if the user clicked the button to add another repeating section.

 

Any help is greatly appreciated, thanks in advance.


Insert Parameters on a form View

  

Hi All

Are they any special Insert Paramters I shoud/need to use on a formView.  I currently have the below datasource but when submitted it only inserts <NULLS> intot he required table.

 <asp:SqlDataSource ID="addChangeDataStore" 
                                   runat="server" 
                                   ConnectionString="<%$ ConnectionStrings:LocalSQLServer %>"
                                   InsertCommand="INSERT INTO tblChanges(NINumber, TitleIDNo, Forename, Surname, ContractPostNumber, PayRef, DateofChange, TypeofChange, UserID, EmployerIDNo, FurtherInfo) VALUES (@NINO, @TitleIDNo, @Forenames, @Surname, @ContractPostNumber, @PayRef, @DateofChange, @TypeofChange, @UserID, @EmployerIDno, @FurtherInfo)" 
                                   SelectCommand="SELECT tblChanges.* FROM tblChanges">  
                                                    
                                    <InsertParameters>
                                        <asp:Parameter Name="Nino" Type="String" ConvertEmptyStringToNull="true" /> 
                                        <asp:Parameter Name="TitleIDNo"  Type="String"  ConvertEmptyStringToNull="true" />
              
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