|
Hi,
you could try.
<br />
if(DayOfWeek.Sunday.CompareTo(YourDate.DayOfWeek) == 0)<br />
{<br />
...<br />
}<br />
the CompareTo function returns either "-1" = false or "0" = true.
hope this helps
greetings pdluke
|
|
|
|
|
VB Code -.net 2.0
-------
Dim dateobj As Date
dateobj = Now
If( dateobj.DayOfWeek = DayOfWeek.Sunday) Then
textbox1.Text=CInt(textbox2.Text) + CInt(textbox3.Text)
Else
textbox1.Text=CInt(textbox2.Text) + CInt(textbox4.Text)
End If
C# Code-.net 2.0
-------
DateTime dateobj;
dateobj = DateTime.Now;
if( dateobj.DayOfWeek == DayOfWeek.Sunday)
{
textbox1.Text=Convert.ToInt32(textbox2.Text) + Convert.ToInt32(textbox3.Text)
}
else
{
textbox1.Text=Convert.ToInt32(textbox2.Text) + Convert.ToInt32(textbox4.Text)
}
|
|
|
|
|
hi
there is a property called
IsWeekend property
I got some information from net i wil give u the link it is
http://www.ucertify.com/articles/70-305/What-is-the-IsWeekend-property.html
check whether its of any use 4 u or not.
Prakash Mishra(Banglore,India)
|
|
|
|
|
hi
How can i convert the sql table like Employee with fields EmpId , EmpName , EmpSal , etc
into XML data using ASP.Net ?
If anyone kw reply me
thanks in advance
Naresh.s.s
|
|
|
|
|
read the table in to a data set then use the WriteXml method of the
DataSet i.e. ds.WriteXml("ToPath") , check also the WriteXmlSchema method.
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi all
actually on my webpage am displaying some data on the datagrid row wise...as per the project requirement am exposing the data to be editable(displaying in the text boxex) by making use of the itemtempale ...and am keeping one button outside the datagird.and while cliking on the button i am updating the entire datagrid by accepting what ever the data is modified
i.e by calling like
foreach(DataGridItem itm in DataGrid1.Items)
{
string st,st1,st2;
st=((Label)itm.Cells[0].FindControl("lblAccountId")).Text;
st1=((TextBox)itm.Cells[1].FindControl("AccCode")).Text;
st2=((TextBox)itm.Cells[2].FindControl("Descrip")).Text;
dataAdapter=new SqlDataAdapter("update AccountCode set AccountCode='" + st1 + "',Description='" + st2 + "'where AccountId=" + st,con);
dataAdapter.Fill(ds,"contentTable");
}
Know what the problem is...there was somany records like (100+ in the database)..if i did like this,it took a database interaction
to update each row ...i.e,for the single click it will take 100+ times of database interaction...
bcz of performance resion i want to avoid these interactions...i want the updation to be done by making single interaction with the database(i.e i want to handle all the datagrid data and take the updation at single time)......Plz help me out ,,or let me have some articles related to this....
regards
yuva
|
|
|
|
|
u can use command builder
dim da as new sqldatadapter("select * from emp",cn)
dim cmb as new sqlcommandbuilder(da)
dim dt as new datatable
da.fill(dt)
dim dr as datarow()
dim i as int = 0
while i < grid.items.count -1
dr = dt.select("AccountId=" & s1)
if dr.length > 0 then
dr(0).item("AccountCode") = s1
dr(1).item("Description") = s2
end if
i +=1
end while
da.update(dt)
|
|
|
|
|
|
Hi,
Junior Boy wrote: Please help me to convert this code to C# .net.
We can't able to work for you. This forum is only for sharing the knowledge.
Regards,
Jay
|
|
|
|
|
Hi Jay,
Thank you for your replied.
And actually I know in this point
Yes, sure if I know something that people posted.
I would like to reply them too.
To me I don't know about VB .net and I just ask for
someone who can help me. If they don't want to it's ok
but If they do that really appreciate in helping.
Regards,
junior boy
|
|
|
|
|
You should use a converter, then work through the bugs. It's really kind of trivial, and a good exercise, to convery a small snippet like this one.
A lot of the commercial converters will convert up to 200 lines in their demo mode, you could also try those.
Some of this code kind of sucks, actually. You could amortise it into something simpler, it's not that well written.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"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 )
|
|
|
|
|
Thank you very much for you suggestion.
Finally I got to know and fix all the bugging.
This is so appreciate for your comment.
Thank you very much,
junior boy
|
|
|
|
|
VB.NET Code :-
Response.Buffer = True<br />
Response.AddHeader("content-disposition", "attachment; filename=MyFile.txt")<br />
Const adTypeBinary As Object = 1<br />
Dim BinaryStream As Object<br />
BinaryStream = CreateObject("ADODB.Stream")<br />
BinaryStream.Type = adTypeBinary<br />
BinaryStream.Open()<br />
BinaryStream.LoadFromFile("C:\data.txt")<br />
Dim BinaryData As Object<br />
BinaryData = BinaryStream.Read<br />
Response.BinaryWrite(BinaryData)<br />
BinaryStream = Nothing<br />
Response.End()
Steve Jowett
-------------------------
Sometimes a man who deserves to be looked down upon because he is a fool, is only despised only because he is an 'I.T. Consultant'
|
|
|
|
|
That looks like VB6 code that is just ported to .NET without converting to .NET technology. There is no reason to use a ADODB.Stream object in .NET, there are better stream objects in the .NET framework. You don't even have to use a stream object in .NET to output a file, there are methods for that in the HttpResponse object.
Real VB.NET code:
Response.Buffer = True<br />
Response.AddHeader("content-disposition", "attachment; filename=MyFile.txt")<br />
Response.WriteFile("C:\data.txt")<br />
Response.End()
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi All,
Here in my application, I've 2 password fields, after filling data in these fields when i change the Dropdownlist value, page_load call autometicly and these password fields lost their values, which i need. Please help me i don't know, what to do.
Regards
SMK
|
|
|
|
|
You need to make the attributes of the textboxes persistent (they retain their values):
txtPassword1.Attributes.Add("Value",txtPassword1.Text.ToString());<br />
txtPassword2.Attributes.Add("Value",txtPassword2.Text.ToString());
Hope this helps
|
|
|
|
|
Hello,
Thanx for ur cooperation, its working properly. Thanx once again.
Regards
SMK
|
|
|
|
|
Always glad to help...
|
|
|
|
|
Hi,
I have file myfile.zip or myfile.doc.
When i try to download this file using code i am able to download teh files as it is i.e
myfile.zip or myfile.doc.
But if I have a file like myfile.abc.zip or myfile.abc.doc
and when i try to download this file the name is getting changed as
myfile[1].abc.zip and myfile[1].abc.doc.
Why is this happening and is there a way to restrict the subscript.
Thanks for reading the query
manjunath
|
|
|
|
|
Hi all,
Please tell that whether Request.Form can be used for a div tag in the code behind of an aspx page.
Thanks
Senthil
|
|
|
|
|
Senthil_GeoEdge wrote: Please tell that whether Request.Form can be used for a div tag in the code behind of an aspx page.
No, you can't use Request.Form for that.
The Request.Form collection contains the data that was sent from the form fields in the form that was posted. Nothing else. If you want some information to be sent to the server when posting the form, you have to put it in a form field.
---
single minded; short sighted; long gone;
|
|
|
|
|
i got a problem how to acesss the values in the columns of gridview in which i am generating rows dynamically by using datatable...the row consists of one textbox and one fileupload components...i want to store the values entered into textbox and the filepath into database ...
could some one help me in this regard
|
|
|
|
|
Hi
I have created one image control and 2 link button controls dynamically and added those controls to panel. when i build the application these 3 controls are appearing side by side but i want to display one below another.
my code is
protected System.Web.UI.WebControls.Panel p1;
ImageButton img;
LinkButton links;
LinkButton linkb;
Label l1;
private void Page_Load(object sender, System.EventArgs e)
{
Session["impath"]="pg/dhee";
for (int i = 1; i < 6; i++)
{
links=new LinkButton();
linkb=new LinkButton();
img = new ImageButton();
img.ID = "img" +i.ToString(); img.ImageUrl="pg/dhee/thumbs/"+ i +".jpg";
links.ID="ls"+i.ToString();
linkb.ID="lb"+i.ToString();
links.Text="800*600";
linkb.Text="1024*768";
l1.Text=" | ";
p1.Controls.Add(img);
p1.Controls.Add(links);
p1.Controls.Add(l1);
p1.Controls.Add(linkb);
}
}
how to do this plz help me
Thanks in advance
Haritha
|
|
|
|
|
Hi Haritha ...
U can put those controls in a table . so that u will get exactly wer do u want ...
Otherwise u can c the LAYOUT option at the top of ur IDE , in that click on "POSITION" after that click "Absolute-Postion Options " , there u can set ...
If u kw this ok otherwise it can usefull for u ...
Bye
Naresh.s.s.
|
|
|
|
|
can anybody help me with a sample task management project... Plz
|
|
|
|