|
iam using c# asp.net and i want to retrieve the system date and put date in text box
any ideas highy appreciated
|
|
|
|
|
You can get that like this:
DateTime.Now
Best Regards,
Apurva Kaushal
|
|
|
|
|
thank u kaushal
thing is i want to display only date is it possible
|
|
|
|
|
Yes you can display the date part by converting it into shortdatestring. Like this:
DateTime.Now.ToShortDateString();
Best Regards,
Apurva Kaushal
|
|
|
|
|
TextBox.Text=DateTime.Now.ToString()
Regards,
Jay
|
|
|
|
|
Unfortunetly, the last two responses are only partially correct.
Here is the code:
First, your cs file;
<code>using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
tbalpha.Text = DateTime.Today.ToShortDateString();
tbalpha.ReadOnly = true;
}
}</code>
Then your HTML/source page
<code><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="tbalpha" runat="server" />
</form>
</body>
</html>
</code>
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
|
|
|
|
|
TextBox1.Text = DateTime.Now.ToString("yyyy.MM.dd");<br />
|
|
|
|
|
Hi,
I need help.
Here we are developing a web application ( using C# ). in that I need to drag and drop the items of a datagrid.
What I need exactly is
If I put the cursor anywhere in a row that row must be selected. ( Without using CheckBoxes, item template column )
Then if I drag the selected row over another row, those two rows must be swapped.
Try to send me some code snippets if possible.
Thanks in advance,
Libran
|
|
|
|
|
Hi,
I am developing a web application. Here I need to drag the rows of a datagrid. Plese anyone send me some examples or some links.
Thanks in advance,
Libran
|
|
|
|
|
i can create a text file in my project that it is full of iformation(asp.net(c#)) but now i want edit that file and fine a word from content of that file how can i do it? can any body help me
|
|
|
|
|
Read from file into a string and use the shared Contains method to find required word.
Hope this helps.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
can u explain a little more plz
|
|
|
|
|
dim f as new file = File.OpenText(filepath)<br />
dim s as string = f.readall<br />
if s.Contains(wordtosearch) Then<br />
' do something<br />
End If
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
Hello,
I'm amking a project in asp.net with vb.users come on my site and make their own site.i want to make a report that how much bandwidth they are using.
not getting how to do this.
Any suggestion plz thanx.
|
|
|
|
|
Hi All,
Please provide me some sample programs on DrillDown Reports.
Sowmya C
|
|
|
|
|
i want to save Audio and Video Files To the Database and And Later i want to play that Files how to do that in ASP.NET
sdfsdf
|
|
|
|
|
As for saving the files, u don't save the auio file to the database, u just save its path on the server so what u need is to upload the file on the server in a path using any file upload script then u play it calling it from it's path
Best Regards
3ala2
|
|
|
|
|
Hi,
I think you must use Windows Media Services for online play audio and video file's. I'm not recommend save audio and video file's in DB. I think you must save path to file's in DB.
|
|
|
|
|
hi,
friends i m facing problem in binding dropdown listbox with two tables. table A and table B. i m succeeed in reterieving data frm both tables in a dropdown listbox but not able to fatch their id's. and i want that content of table A is parent & contant of table B is child, means first comes parent then in next row its child content will com from second table who's id is same as of parent id.
pls help me .
waiting for rply.
thanx
bye.
rahul saini
|
|
|
|
|
What is the query you are using and what is the output that you require?
Post some code, that will help us help you.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
Dim DS As DataSet
Dim MyCommand As SqlDataAdapter
'create connection
Dim MyConnection As SqlConnection
MyConnection = New SqlConnection(Application("dbStrConn").ToString())
'first statement to run
MyCommand = New SqlDataAdapter("select* from jobSectorCategory where jobSectorCategoryStatus='A'", MyConnection)
DS = New DataSet
MyCommand.Fill(DS, "jobSectorCategory")
MyCommand.SelectCommand.CommandText = "select * from jobSectorSubCategory where jobSectorSubCategoryStatus='A'"
MyCommand.Fill(DS, "jobSectorSubCategory")
Dim i, j As Integer
Dim dc As DataColumn
Dim mystrval As String
Dim dt As DataTable
Dim dr As DataRow
For Each dt In DS.Tables
For i = 0 To dt.Rows.Count - 1
For Each dc In dt.Columns
Select Case dc.ColumnName
Case "jobSectorCategoryText"
mystrval = mystrval & dt.Rows(i)(dc.ColumnName).ToString
Case "jobSectorSubCategoryText"
mystrval = mystrval & dt.Rows(i)(dc.ColumnName).ToString
End Select
Next
'Response.Write("ya hai--")
'Response.Write(mystrval)
chooseSector.Items.Add(mystrval)
mystrval = ""
Next
Next
thanx for showning ur interest in my problem.
i m using dis,with dis code i am able to get data but the ordering is not according to want . here first all the records of first table then second table. but i want record of first table as heading of second table.
thanx
waiting
regards
rahul
rahul saini
|
|
|
|
|
monuSaini wrote: mystrval = mystrval & dt.Rows(i)(dc.ColumnName).ToString
Suggestion:
Use a stringbuilder instead of a string when doing big concats.
Having said that, from this code, it seems that you will get a bunch of sectors and sub sectors as a single item in the drop down - is that what you want?
monuSaini wrote: get data but the ordering is not according to want
Further, when you talk about ordering, do you want the sub sectors to be displayed below the sectors? In such a case, what is the relation between these 2 tables - is it Sector ID, - if it is, then a single query should return you the results - show the structure of the tables.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
Sry for Dat i will remember in future,
sectorTable
sectorId
sectorName
date
subSector Table
SubSectorId
sectorId
subsectorName
date
output should like dis in dropdownlist box
sectorName(a)
subsectorName(a)
subsectorName(a)
sectorName(b)
subsectorName(b)
subsectorName(b)
a & b are sectorId
regards,
Rahul
rahul saini
|
|
|
|
|
Query:
select sectorTable.sectorId Sectorid, sectorName, SubSectorId, subsectorName<br />
from sectorTable, subSectorTable<br />
where sectorTable.sectorId = subSectorTable.sectorId<br />
order by sectorTable.sectorId
Change as per table names and syntax as per database type.
Code for filling drop down:
dim prevsecid as integer = 0<br />
<br />
dr.read (where dr is the datareader object)<br />
prevsecid = dr("Sectorid")<br />
add sector info to drop down (text = sector name, value = sector id)<br />
add sub sector info to drop down (text = sub sector name, value = sub sector id)<br />
<br />
while dr.read<br />
<br />
if prevsecid = dr("Sectorid")<br />
<br />
add sub sector info to drop down<br />
<br />
else<br />
<br />
prevsecid = dr("Sectorid")<br />
add sector info to drop down<br />
add sub sector info to drop down<br />
<br />
end if<br />
<br />
Loop
You can put the foll code in a function for easy reuse
add sector info to drop down
add sub sector info to drop down
If you want the indentation as shown in your post above, add something like "-->" to the subsector name when adding it to dropdown.
Hope this helps.
Shreekar
http://shreekarishere.blogspot.com
|
|
|
|
|
hi,
thanks for dis sollution.
but code to fill dropdown is not working. can u please explain little bit more.
thnkx.
regards
rahul
rahul saini
|
|
|
|