|
Declare the TextBox as a class level control.e.g. just before Page_Load,
declare as:
private TextBox t1 = new TextBox();
It'll work fine then.....
Note: Right now u r declaring TextBox in Page_Load , once the control goes out of Page_Load, the TextBox1 context is gone. Hence this error is coming. If u declare it on class level , it'll be solved.
|
|
|
|
|
public partial class Default2 : System.Web.UI.Page
{
private TextBox TextBox1;
public void Page_Load(object sender, EventArgs e)
{
TextBox1 = new TextBox();
TextBox1.ID = "TextBox1";
form1.Controls.Add(TextBox1);
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Server=localhost;uid='sa';pwd='sa';DataBase=master");
SqlCommand com=new SqlCommand("insert into table1 values('"+TextBox1.Text+"')",con);
SqlDataReader rr=com.ExecuteReader();
}
}
|
|
|
|
|
hi!
I am doing a website in visual studio 2005.in my asp.net page i have got a grid view which takes the data from the database dynamically. In my source code i have set the wrap property of AlternatingRowStyle,FooterStyle,RowStyle,EditRowSt yle,SelectedRowStyle,EmptyDataRowStyle to "false". this is because i dont want the data in my cells to go to the next line. when i run it in mozilla browser the grid view appears fine,there is no wrapping but when i run the same in internet explorer the cell data goes to the next line. what should i do for this.what other code should i write to prevent this wrapping in internet explorer browser.i am using c#
Kindly help. Thanking in advance!
|
|
|
|
|
This is a browser issue and can only be fixed (if indeed it can) with CSS styles.
|
|
|
|
|
HI FRIENDS
I HAVE WORKED IN J2EE (STRUTS).FOR EXAMPLE I AM CREATING A LOGIN PAGE IN J2EE I HAVE TO CREATE A CONTEXT DIRECTORY,THEN I HAVE TO CONFIGURE MY STRUTS.CONFIG FILE,SERVER.XML FILE IN CONF DIRECTORY OF TOMCAT.WHEN I SUBMIT MY FORM WITH ID AND PWD .THEN THE JSP PAGE WILL BE CALLED AND VALUES ARE TRANSFERED BY GET,SET PROPERTY IF I AM USUING JAVA BEANS.THEN AFTER MAPPING IN STRUTS.CONFIG FILE THE CORRESPONDING .CLASS FILE WILL BE CALLED AND IF MY LOGIN IS VERIFIED BY DATABASE THEN MY FORWARD PAGE WILL BE WELCOME.JSP ELSE I WILL BE FORWARRED OR INCLUDED BY LOGIN AGAIN PAGE OR INVALID USER.
IF I WILL DO THE SAME THING IN ASP TECHNOLOGY HOW CAN I DO IT.PLEASE GIVE ME A COMPLETE DESCRIPTION ABOUT THIS MECHANISM AS I HAVE DESCRIBED FOR J2EE.
BYE
LOOKING FORWARD TO RESPONSE..
|
|
|
|
|
Please refrain from using capitals, it hurts my eyes.
Have you looked at the built-in ASP.NET login controls? You'll also want to configure user access rights in web.config. And use JSF instead of struts.
|
|
|
|
|
Parameswar Mala wrote: HI FRIENDS
I HAVE WORKED IN J2EE (STRUTS).FOR EXAMPLE I AM CREATING A LOGIN PAGE IN J2EE I HAVE TO CREATE A CONTEXT DIRECTORY,THEN I HAVE TO CONFIGURE MY STRUTS.CONFIG FILE,SERVER.XML FILE IN CONF DIRECTORY OF TOMCAT.WHEN I SUBMIT MY FORM WITH ID AND PWD .THEN THE JSP PAGE WILL BE CALLED AND VALUES ARE TRANSFERED BY GET,SET PROPERTY IF I AM USUING JAVA BEANS.THEN AFTER MAPPING IN STRUTS.CONFIG FILE THE CORRESPONDING .CLASS FILE WILL BE CALLED AND IF MY LOGIN IS VERIFIED BY DATABASE THEN MY FORWARD PAGE WILL BE WELCOME.JSP ELSE I WILL BE FORWARRED OR INCLUDED BY LOGIN AGAIN PAGE OR INVALID USER.
IF I WILL DO THE SAME THING IN ASP TECHNOLOGY HOW CAN I DO IT.PLEASE GIVE ME A COMPLETE DESCRIPTION ABOUT THIS MECHANISM AS I HAVE DESCRIBED FOR J2EE.
BYE
LOOKING FORWARD TO RESPONSE..
Are you angry on somebody? All capitals means shouting and would most likely intimidate the readers.
|
|
|
|
|
I want to move the select/edit-update column to the right hand side of datagrid.Does anybody know how can u do this!!! Thanks in advance!!!
|
|
|
|
|
in template of datagrid u can do this
|
|
|
|
|
use the 'Edit Columns' option in design view and reorder them?
|
|
|
|
|
Is this option available in .net 2003 bcas i tried editing the template but it doesn`t allow to change anything.
|
|
|
|
|
yes u can do it ...
select your datagrid,then in the properties of your datagrid,click on " property builder" ...
then in the " column " you can set ur changes ... or with " convert to template ..."
|
|
|
|
|
hi all
how to send and recieve mails using .net2005 give me some examples...
heip me....it is urgent
|
|
|
|
|
Check the below link
Email
HC
Best Regards,
Haissam Abdul Malak
My Blog
|
|
|
|
|
|
how do I INSIDE THE VALUES IN THE DROPDOWNLISTBOX
OGA M
|
|
|
|
|
|
|
Depends on your requirment Items can be added Staticly or dynamically
1) static way :-
Right click the drop down list go to collection/items add there
2) Dynamically :-
Views.Items.Add(new ListItem("StringName","StringValue");
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
You can add the values inside of the dropdownlist by
in
asp.net(c#)
void page_load()
{
--------
---------
dropdownlist1.Items.Add("INDIA");
dropdownlist1.Items.Add("CHINA");
dropdownlist1.Items.Add("U.S.A");
dropdownlist1.Items.Add("U.A.E");
--------
-----
}
|
|
|
|
|
Hi,
I want to disablethe image button in certain cases. But i am not able to find any enabled event corressponding toit. How can i do it?
Please helpis needed.
Riz
|
|
|
|
|
Set its Enabled property to false?
|
|
|
|
|
After which event you want to disable the Image button
Write this after that
ImageButton1.Visible = false;
or add a placeHolder put imagebutton in it and make Visible false of that placeholder
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Actually i wanted to disable the image and by mistake i said image button.
dou knw how to do it?
Riz
|
|
|
|
|
But where are you Populating the Image On which control you are showing the image
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|