|
The DateTime.Now property will give u the answer just get the current year n month from that.
|
|
|
|
|
I am using the AJAX tab control on a page and it contains a DropDownList which is populated at runtime. When the page is refreshed at postback, the Dropdownlist is cleared. The Viewstate property is ON for DDL and the page. I am unable to understand why is this happening.
I have tried by putting the DDL outsite the Tabs with no luck.
Working under
Visual studio 2005
Microsoft windows Server2003
|
|
|
|
|
If you always set the datasource for the list, that will reset the selection.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
i didnot set any datasource but i am populating it Item by Item just once when the page loads the first time.
It is supposed to retain its contents after each postback.and thats all what i want.
it shows everything as required the first time but nothing after a postback.
Following is the code segment, its written in PageLoad
If Page.IsPostBack = False Then
Dim Datareader As SqlDataReader
Datareader = GetServers(Session("CompanyId"))
Try
While Datareader.Read()
Dim text As String, value As String
value = Datareader("NetworkServerId")
If Not Datareader("ServerName") = "" Then
text = Datareader("ServerIP").ToString + " ( " + Datareader("ServerName").ToString + " )"
Else
text = Datareader("ServerIP").ToString
End If
Dim item As New ListItem(text, value)
DDL_Servers.Items.Add(item)
End While
Datareader.Close()
Catch ex As Exception
If Datareader IsNot Nothing Then
Datareader.Close()
End If
End Try
|
|
|
|
|
OK, that looks like it should work, obviously if you remove the check for postback, you will lose your selection.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
its not the answer of my question, u know it.
i am expecting some help please try to solve my problem or better not bother to reply
|
|
|
|
|
I'm sorry, I didn't realise I had an obligation. It's obvious you've not provided enough info, so I was trying to figure out what the missing issue was, but if you're not happy with that, I'll make a mental note not to bother you in future.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
What the f*** you think he is doing?
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
shahid_isb85 wrote: using the AJAX tab control
This[^] one?
shahid_isb85 wrote: I have tried by putting the DDL outsite the Tabs with no luck.
Which means what? You are still losing dropdownlist's items after postback?
shahid_isb85 wrote: I am unable to understand why is this happening.
Try to find out! If I was you, I'd set up some breakpoints - at least at page_load. You should see then WHAT is happening with your dropdown, and if you still don't understand WHY is it happening, no problem, post it here. Also you can try to comment out as much code as you can (both in codebehind and aspx page) to simplify the problem.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
Hello Everyone,
Can anybody let me know that wht should i need to do.
Actually i've designed a site and there is "Contact" form in my site but i'm not getting the way to where to store the information filled by a user through my "Contact" form
If i should use email to send the information at a email-id
Then plz let me know how to send email in ASP.NET with c#
Thnx in advance
|
|
|
|
|
Hi Dear
To store values you can use the Database Connectivity the value will stored into sql or access database and to send mail to user you can use theh following code: -
1. To use it you have to import System.Net & System.Net.Mail namespaces.
2. You need to copy the following into web.config file before closing of configuration tag.
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="<from mail id>">
<network
host="mail.dbmindia.com<host server name>"
userName="<from mail id>"
password="<password>"
port="25"
defaultCredentials="true"
/>
</smtp>
</mailSettings>
</system.net>
3. Use this code in your web page to send the mail to any id.
MailMessage mail1 = new MailMessage();
mail1.From = new MailAddress("<from email id>");
try
{
mail1.To.Add(<to mail id>);
}
catch (Exception mailex)
{
Response.Write("Email id is not in valid form");
Response.Write(mailex.ToString());
}
mail1.Subject = "<Subject for the mail";
mail1.IsBodyHtml = true;
mail1.Body = "<body message>"
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new System.Net.NetworkCredential("<from mail id>", "<from mail id's password>");
try
{
smtp.Send(mail1);
}
catch (Exception ex)
{
Response.Write("Failed to send the mail");
Response.Write(ex.ToString());
}
With Regards
Yogesh Agarwal
|
|
|
|
|
Hello I Bind my dropdownlist to datasource
<asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource1"
DataTextField="LocName" DataValueField="LocName" SelectedValue='<%# Bind("myValue") %>'
my problem when myValue is null in DB
give error
how can I solve that ?
aj123
|
|
|
|
|
you can test whether the value is Null before setting the SelectedValue. you can test against System.DBNull.Value
|
|
|
|
|
how can u do that?
In dataSource?
aj123
|
|
|
|
|
I am not a big fan of datasource controls but thats another discussion.You can bind the SelectedValue to a function that takes the value as parameter and test for NULL in it, or you can wire up the ondatabound event...
|
|
|
|
|
Hi friends
In my Update Panel I have one gridview in which I bind three textboxes and three required field validator in ItemTemplate.
I have one button which is placed out of update panel.
On page load event i bind only one row of gridview.
Now i have one link button.
When i click on link button,new row of grid view will be added.
Now my problem is that when I click on Button then requiredfield validators fires only first three textboxes of first row.
They are not fire for adding new rows textboxes.
Can anybody give me right suggestion for this?
Thanks in advance
Pathan
GOD HELP THOSE WHO HELP THEMSELVES
|
|
|
|
|
Hi Guys,
Can you provide me with xml reference / snippet where it could read, then parse the xml, I tried looking around on the articles but I find them more advance.
Thanks
Dom
|
|
|
|
|
|
Thanks Fred, the site works great for me
Dom
|
|
|
|
|
I am developing a attendance application where I need to generate the report.I have planned to use Crystal reports.
Now my requirement is:
1)I need to create a dataset where I need to have fields from three different database-tables.How to do that?Is that possible?
2)I need to print a column for Present,Absent,Holiday.
3)binding the dataset with the crystal reports.
kindly help me on doing this...
Thanks in advance.
Happy Programming!!!
|
|
|
|
|
Hello Everybody
I am doing a project name Help Desk. On my gridview there is a Button and some Templated Field. I put a CheckBox on Item Template. When you click the Button then another page will be come ( about who will help you), when you finished fill up that form then I want see that particular rows CheckBox is ticked (make sure some one is going to you help you).
Any help will be greatful for me. Waiting for your reply
Sarfarj Ahmed
|
|
|
|
|
hi all
so I thought WCF could call web services too. Is this true?
or is it either WCF OR Web services?
if you CAN call a web service through WCF, how would you
configure its <endpoint>?
I have this all configured and my WS is running, & my proxy
instantiates fine too (meaning it doesnt return null), but when I make
a call to a method in my WS. it says "Object reference set to null".
Or do I have to create a different proxy for the web service? is
that the difference between WCF & WS?
thanks in advance!
Moazzam
-- modified at 3:30 Saturday 30th June, 2007
|
|
|
|
|
For an asp.net application, I'm using an xml file to read in configuration settings. The problem is... some of the settings can hold sensitive data. I want to ensure that the application can read in the values, but that the server will not acknowledge any http requests on the file. Prior programming conventions would dictate placing the configuration file somewhere outside of the scope of the web root, but that makes for more difficult installations... I'm trying to keep the whole application limited to one directory.
So... is there a web.config setting I could use to grant server access to a file, but not http access?
|
|
|
|
|
You can use the location element in ASP.NET 2.0 (not sure about previous versions) MSDN[^]
|
|
|
|
|
Thanks a lot; knowing this is definitely a big piece of the puzzle, as it will surely be how I target the specific file. But I'm still unsure of the specific configuration that will instruct IIS to reject http requests for that file, while still allowing server requests.
-Roo
|
|
|
|