|
The order is page load, then events, then page prerender. I'd say you're loading your data in page load, before the event fires to add the new record.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian,
Thanks that makes sense. Would it make any sense to reload (?fill?) in the prerender stage?
Thanks
Mike
|
|
|
|
|
I think Rebinding the datasource after the insert will solve the issue.
|
|
|
|
|
Thanks for the advice I got it to work by overriding the Page's OnPreRender method!
Works like a charm!
Mike
|
|
|
|
|
I have an ASP.net web page,
From the web page how can i write
the content of a text box to serial port.
Please help me.
|
|
|
|
|
Member 4663137 wrote: From the web page how can i write
the content of a text box to serial port.
It's not possible. ASP.NET is not built for that.
|
|
|
|
|
I have an application that I would like to show different login pages based on the client or url. I have the roles and members setup and I have a default value for the loginurl parameter in the web.config. I would like to intercept this before the page redirects to login.aspx and be able to define the loginurl or use the FormsAuthentication.RedirectToLoginPage() method. Where is the best way to do this?
Also I am using a basepage for all of my pages.
|
|
|
|
|
HELP... one of my DBA wrote me this oracle sp, when my web form call this sp, I will pass over 2 params which which are firstname and lastname, then this sp will insert the 2 params to the table, if the insert succ, the sp will return 0 else return and 99 for error, how can i retrieve the error_code from my code behind. i dont need to retrieve the error_mes
PROCEDURE Insert_Data(
i_lastname IN VARCHAR2,
i_firstname IN VARCHAR2,
error_code OUT NUMBER,
error_mes OUT VARCHAR2
)
IS
BEGIN
INSERT
INTO new_table(
rec_id,
i_firstname,
i_lastname,
created_date,
new_old,
created_by
)
VALUES (
rec_id.nextval,
firstname,
lastname,
SYSDATE,
'New'
);
error_code := SQLCODE;
error_mes := SUBSTR (SQLERRM, 1, 250);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
error_code := SQLCODE;
error_mes := SUBSTR (SQLERRM, 1, 250);
END;
from code behind , how can i retrive the error code
---------------------------------
public int Insert_Data(string first_name, string last_name)
{
string OracleConnString = ConfigurationManager.ConnectionStrings["connstr"].ToString();
using (OracleConnection conn = new OracleConnection(OracleConnString))
{
OracleCommand cmd = new OracleCommand("Class.Insert_Data", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("i_firstname", OracleDbType.Varchar2, first_name, ParameterDirection.Input);
cmd.Parameters.Add("i_lastname", OracleDbType.Varchar2, last_name, ParameterDirection.Input);
cmd.Parameters.Add("error_code", OracleDbType.Int32).Direction = ParameterDirection.Output;
conn.Open();
cmd.ExecuteNonQuery();
//What should i do here
return return_code;
}
}
|
|
|
|
|
Kennie_n2000 wrote: error_code OUT NUMBER,
As you can see the errorcode is an OUT parameter, value would be in the 3rd parameter. You can get it like
cmd.Parameters[2].Value
|
|
|
|
|
I tried what u 've suggest but i am getting the exception error" exception {"ORA-06550: line 1, column 15:\nPLS-00306: wrong number or types of arguments in call to....
when it execute line cmd.ExecuteNonQuery();
I should only need to pass in 2 arguments which are firstname and lastname only right ? any ideas ?
public int Insert_Data(string first_name, string last_name)
{
string OracleConnString = ConfigurationManager.ConnectionStrings["connstr"].ToString();
using (OracleConnection conn = new OracleConnection(OracleConnString))
{
OracleCommand cmd = new OracleCommand("Class.Insert_Data", conn);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("i_firstname", OracleDbType.Varchar2, first_name, ParameterDirection.Input);
cmd.Parameters.Add("i_lastname", OracleDbType.Varchar2, last_name, ParameterDirection.Input);
cmd.Parameters.Add("error_code", OracleDbType.Int32).Direction = ParameterDirection.Output;
conn.Open();
cmd.ExecuteNonQuery();
return Convert.ToInt32(cmd.Parameters[2].Value);
}
}
|
|
|
|
|
I'm using a DataList to present a list of TextBox - RadioButton pairs. Now I don't want to go through the whole thing of putting a row into edit mode etc. I want to do a client side Ajax postback when the RadioButton is clicked, or on blur of the textbox. How do I get the parent row of these controls? I need this to store an ID attribute so I can specify which record to update during the Ajax call.
I've thought of using an invisible column with the ID, but I need to know how to access the parent of the control causing the event, then access its cells collection, then get back to the ID value.
|
|
|
|
|
When i developed application in asp.net i have used differnt validators.The question is if i use Example:textbox shd not be blank
I have used one requiredfieldvalidator
and in code behind like in
if
isdbnull(txt.text) or txt.text=""
msgbox("blank")
elseif....
end if
if i use both validators as well as validators it that cause application performance??
thistype of code occurs many times in the application.So please can any body give some answer.
And also "autopostback=true" property of some controls makes the server hits more.So at the user end appln becomes slow.What to do for this??But i have to set that property as per appln concern.
Please respond somebody for this question.
kissy
|
|
|
|
|
IF you are using required field validator for the textbox then i think there is no need of checking the textbox is empty or not .....
Do validations only once client side or server side (depends on the security of data).
Kissy16 wrote: But i have to set that property as per appln concern
As you said you need to change the things upon user interaction.
First question is that could you use javascript for the same ?
If yes then you can have some javascript function that will do the things that you are doing by postbacking the whole page ...
Another way AJAX but it is not going to make drastic changes.
So main conclusion is what you are doing at server side could you perform it at client side using javascript ?
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
Kissy16 wrote: if
isdbnull(txt.text) or txt.text=""
msgbox("blank")
elseif....
end if
This is incorrect. In ASP.NET you can't display a message box as you do in windows applications. IsDbNull checks whether the value belongs to System.DbNull type. So you can't check the text box string in such a way.
When you use validators, always check the Page.IsValid property to make sure all validators are validated successfully.
If(Page.IsValid) Then
'Do your stuff
End If
Kissy16 wrote: And also "autopostback=true" property of some controls makes the server hits more.So at the user end appln becomes slow.What to do for this??But i have to set that property as per appln concern.
It will hit in the browser. You can't avoid that. But if you need to avoid page getting refreshed, use AJAX. But AJAX request also hits server. Also I don't think that it will be a big performance problem.
|
|
|
|
|
For example: Take a site like Lastminute.com when u search a list of result in a grid and bulk of data is coming from the database server. So it ll take time.. I need to place a waiting page in between the two pages...
Please help me. Urgent
Gopinath.R
|
|
|
|
|
Use Ajax
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
I need some sample coding. please show that comes how. I want a loading page between two pages. I hope you know gmail like loading page. when i click the search button. immediately a loaing page should come. and then third page will show exactly after the data are retrieved from database server into server control like datagrid. Assume 50000 datas in a single page
Gopinath.R
|
|
|
|
|
Yes !!!
This can be done easily using Ajax.
Ajaxupdate panel will do for you !!!!
Try this link !!!
UpdateProgress Control Overview
[^]
Best Regards
-----------------
Abhijit Jana
Microsoft Certified Professional
"Success is Journey it's not a destination"
|
|
|
|
|
Hi to all
How to send mail through SQL Server using triggers
Thanks
|
|
|
|
|
|
What about SQL 2000? Thanks.
|
|
|
|
|
|
Hi,
I m using first time Ajax in my site so i don't know how to bind Cascading DropDown with database at run time?
Plz tell me the right way to do it
Thanks with anticipation
|
|
|
|
|
please look at once <a href="http://asp.net/ajax/ajaxcontroltoolkit/samples/">http://asp.net/ajax/ajaxcontroltoolkit/samples/</a>[<a href="http://asp.net/ajax/ajaxcontroltoolkit/samples/" target="_blank" title="New Window">^</a>]
|
|
|
|
|
How change a Font Name ButtonClick() event.
|
|
|
|