|
Hi,
I have a simple form with a textbox and a drop down list on it. I've used an ASP.NET (2.0) ddl control and an ASP.NET button for submitting the form. I have an event handler on the submit button, btnSubmit_Click() which triggers when the submit button is clicked.
When I try and access the ddl's value in the event handler, it's always set to the original value it was when the page was loaded. In other words, it ignores whatever the user changes it too before clicking "Submit".
Here's my aspx:
<form id="frmTest" runat="server" action="test.aspx" method="post">
<asp:DropDownList ID="ddlColor" runat="server">
<asp:ListItem Value="Red">Red</asp:ListItem>
<asp:ListItem Value="Amber">Amber</asp:ListItem>
<asp:ListItem Value="Green">Green</asp:ListItem>
</asp:DropDownList>
<asp:button id="btnSubmit" text="Submit!" onClick="btnSubmit_Click" runat="server" />
</form>
Here's the code behind:
protected void btnSubmit_Click(object sender, EventArgs e)
{
String str = ddlColor.SelectedItem.Text;
}
Do I need to call anything to get the changed value of the DDL before I look at the <code>ddlColor.SelectedItem.Text</code> property?
|
|
|
|
|
Hi,
No need to call anything to get the changed value of the DDL.
|
|
|
|
|
Give if not page.ispostback then cmd....,
or change the auto postback properties in ddl,
Magesh
|
|
|
|
|
I have a data grid in ASP.NET 2.0 that contains the following fields:
ID
Task
Comments
User
The User field is populated with the login name of the user who created the item. How can I filter this dataset with a Page_Load event based upon the users login name?
GT
|
|
|
|
|
If you want to disply only a particular user's items only in the datagrid, you will have to create a different datasource for that. For example, if you are using dataset or datatable as datasource, you will have to create a dataview and filter the particular user id. Then bind the datagrid with the dataview as datasource
hope this will help
|
|
|
|
|
Hi,
Firstly You must have a dataset on your hand code behind.
You can write a method like this,
protected void Page_Load(object sender, EventArgs e)
{
if{!IsPostBack}
{
querystring = "Your query";
GetData(String queryString);
yourdatagrid.DataBind;
}
}
DataSet GetData(String queryString)
{
DataSet ds = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(queryString, SqlConnection);
adapter.Fill(ds);
return ds;
}
I hope I understand you correctly.
|
|
|
|
|
Well let me see if I can explain a little better.
I want to somehow take the current users login name and filter a table with that string.
GT
|
|
|
|
|
Yourdatasource.Filter = "User = " + Session["LoginName"].ToString;
My last answer!
|
|
|
|
|
The grids expose a RowFilter property, which can be set to something like
myGrid.RowFilter = "UserName=" + userNameToFilterBy;
myGrid.DataBind();
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
For a project I need a rather advanced deployment scenario. I want to deploy my asp.net web app to the server just once and use multiple virtual directories that share the binaries but have the aspx files separate where needed. I know microsoft does the same thing with sharepoint, but I couldn't find any information to achieve the same effect.
Anyone know of a way to achieve this?
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
I've been experimenting with some settings and found out that you can build something like the following:
- Web1 - C:\AppInstance
- MasterPages (VDir) -- C:\Tenants\Tenant1\MasterPages
- App_Themes (VDir) -- C:\Tenants\Tenant1\App_Themes
- Web2 - C:\AppInstance
- MasterPages (VDir) -- C:\Tenants\Tenant2\MasterPages
- App_Themes (VDir) -- C:\Tenants\Tenant2\App_Themes
Which is exactly what I wanted. Now to get the database to do something like that too.
WM.
What about weapons of mass-construction?
"What? Its an Apple MacBook Pro. They are sexy!" - Paul Watson
|
|
|
|
|
With LAN connection to my IIS computer, it's possible for others to access this IIS server too?
I have developed my asp.net 2.0 with vb2005 and sqlserver 2005 on WIndows XP. I have created a virtual directory from IIS mapped to teh website folder.
I want to test this site on a Local Area Network(Workgroup).
I tried something like this from one of the pc on the network by typing in internet explorer
http://192.168.1.5/ASPLearning/Default.aspx
where 192.168.1.5 is the IP address of the IIS Computer
ASPLearning is the website Name as given in IIS
The page did not display.
Please is there anything i need to do? pls help
t.aransiola
|
|
|
|
|
Yes !
Can you ping the IIS server from the client machine or see the front page. Is the security on the Virtual Directory set to anyonous (easy for me to spell )
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
Hi guys, I always wonder where to get all the reference and detailed info about javascript. I have a general knowledge about javascript but when I found javascript codes on different advanced sites they all have Hi-Fi syntax. For instance, divs[i].className=='popupcontainer'. I use VS2005 but it provides basic properties and methods. In addition, how can I be sure what methods and properties the javascript object takes. Unlike in VS.Net for C# or VB, we can see all the properties by just typing "."/ period and it tells what does that method do.
Nevertheless, I have seen a javacript in 24 days but that talks about general stuff. Can sombody tells me where can I found all the javascipt detailed info about methods and properties.
Thanks
|
|
|
|
|
Try "Pure Javascript" (Sams Publishing) by Wyke, Gilliam and Ting. I bought it 6 years ago and it's still useful. It is a true reference. The first few chapters cover the basics, then the rest of the book is a reference with every object with each method and property. Also, each object, method and property has an example and a notes which browsers support it with version numbers.
I love it. Whenever I have a question about any javascript I go there first.
|
|
|
|
|
i have the same proplem with you, i often searched it in google when i have some javascript proplem.
|
|
|
|
|
|
http://www.w3schools.com/[^] is my bible.
And the intellisense in 2K5 for JS is crappy - just have to deal with it unfortunately....
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi All,
I came up with a new issue/question.
I have seen in many sites that when I enter my username/password, it displays a new page wherein it says "Verifying Username/Password. Please wait..."
I wonder what does it do behind the scene? Does it really take 5-6 seconds to verify a username/password? if yes, what code runs behind it? If no, then why they have to display that page?
I think the authentication process normally does not take more than 1 second.
What do u say about this?
Thanx
|
|
|
|
|
I think it's just a loading bar that keep the website alive and responsive.
|
|
|
|
|
we will consider one more i e network traffic , i think u need to read more.
|
|
|
|
|
Need Help...
I am using Visual Studio .Net 2003 for developing the application.
I included Microsoft Word 9.0 Object Library through Add Reference - COM tab -& then selecting it.
But still i could not use the .Office namespace. The intellisense was detecting only the default namespaces for Microsoft. ie CSharp,Win32,VisualBasic.
When i declared an object as
<pre>
Microsoft.Office.Interop.Word.Application wordApp =
new Microsoft.Office.Interop.Word.Application(); </pre>
and when compiled, it was giving a syntax error as
The type or namespace name 'Office' does not exist in the class or namespace
'Microsoft' (are you missing an assembly reference ? )
Still i could define an object as
<pre> Word.ApplicationClass oWordApp = new Word.ApplicationClass(); </pre>
and it was compiling successfully.
If any body could tell me why i am not able to access the Office namespace even after adding the reference to the assembly...i will be really grateful...
jij
|
|
|
|
|
There is an option when you install office to include the .net hooks. If you had office installed on the PC before the .net framework was loaded these hooks will not be set. If you open your office install you will see some new options for installing the .net pieces of office.
Hope that helps.
Ben
|
|
|
|
|
Thanks Ben.But when i removed and reinstalled office 2000 a dialog box came up which said that
Your Web Server's configuration will allow anyone to author pages on your web server once the extensions are installed.
To fix this, stop installing the extensions now, reconfigure IIS to use an NTFS partition and then use the Front page Server administrator tool to install the extensions.
Are you sure that you want to install the extensions ?
Well i gave no to that and proceeded with the installation.
Can any body tell me how to reconfigure IIS to use an NTFS partition and then use Front page Server administrator tool to install the extensions.
If any body could give me some hints i'll be grateful....
jij
|
|
|
|
|
hi all, i m using textbox control with multiline in asp.net website in visual studio 2003,its size(length n width) is changed from one what i see on IE, size is shorten n look very smaller(basically its Comments section textbox),i tried to increaes it size but was not successful any idea.
Regards.
Tasleem Arif
|
|
|
|