|
how can i delete a file from given location.
such as i want to delete file aa at given loaction c:\\abc\xyz\\aa.txt.in asp.net 2005 with c#
dcjoshi2
|
|
|
|
|
Hi
Use this it might help u
System.IO.File.Delete(Server.MapPath("filetodelete.ext"));
Thanks
Aavesh
|
|
|
|
|
System.IO.File.Delete("c:\\abc\xyz\\aa.txt");
(This does not give an exception if the file does not exist.)
---
b { font-weight: normal; }
|
|
|
|
|
Is it possible in Asp.net to display in a dropdownlist both name and values at a time(Like listview in vb.net).
If not possible with the dropdownlist wat we have to use to do so.
i need to display both values for selection.give me a suggestion
thanks in advance.
|
|
|
|
|
You can simply create a property in you underlying object called something like 'DisplayName' and use that as your DataTextField. For example, if you were wanting to display a list of States and you had state objects, you could do this:
public class State
{
private string code;
public string Code
{
get { return code; }
set { code = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
public string DisplayName
{
get { return string.Format( "({0}) {1}", code, name ); }
}
}
So now when you set your dropdownlist fields, just use 'DisplayName' as your DataTextField and use 'Code' as your DataValueField.
List<State> states = GetAllStates();
ddlStates.DataTextField = "DisplayName";
ddlStates.DataValueField = "Code";
ddlStates.DataSource = states;
ddlStates.DataBind();
Hope that helps.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Like Matt said you can concatenate the two fields and bind it to the control, another option is that you can use a custom dropdownlist that supports displaying data with multiple columns like this one[^], you can find more available out there.
|
|
|
|
|
i use SQL Server 2000 and asp.net 1.1
i have MultiLine TextBox in my Site ,, admin add the text and press Enter to have newline Line and save it in the database
but in my label that want to show the text , new lines don't show
Why ?
MHf
|
|
|
|
|
HTML ignores newlines unless it is encompassed within a PRE tag. You may need to use BR tags to introduce line breaks.
|
|
|
|
|
You need to do something like:
....
string value = "......";
Label1.Text = vallue.Replace(Environment.NewLine, "<br/>");
...
|
|
|
|
|
i have problem with validation controls after deploying. page is posting back with out any client side validations. please give the solution for this problem
Pradeep Reddy
|
|
|
|
|
Hi
Put your Code In
if(Isvalid) then
End if
Then it will work fine
i hope this will help u..
Aavesh
|
|
|
|
|
yes i did what you told, but validations are working after postback.
Pradeep Reddy
|
|
|
|
|
I think it will work fine
Have u did like this
Private Sub addcity_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
If (IsValid) Then
Ur code...............
End If
End Sub
if so then it will work fine
Aavesh
|
|
|
|
|
Which version of ASP.NET are you using? 1.1 or 2.0? The validators of the old version 1.1 do not work on non-Microsoft browsers afaik.
|
|
|
|
|
Hi,
Please help me. I need to write code for drag and drop of Datagrid Items.
Please send me some links.
Thanks in advance.
Regards,
Libran
|
|
|
|
|
Hi,
These articles may help you for drag and drop of Datagrid Items.
MSDN[^]
Drag & Drop[^]
Regards,
Satips.
|
|
|
|
|
Thanks for ur reply.
I am not able to get the required solution.
Please help me.Send some code snippets.
Thanks,
Libran
|
|
|
|
|
hi all,i am in need of developing a web application which wil send and receive the sms and e-mail's to and from the mobile devices...using GPRS..i know this is possible ...but i dont know where to start and how to start... please give me some articles..or some guidance to develope my application....
ayyp
|
|
|
|
|
You may need liasion with your telco who may provide gateway services Or check out sites like SmsCountry at http://www.smscountry.com/[^]
|
|
|
|
|
Hello,everyone:
Now i have a datagrid, in which each cell may contain many words. it looks quite ugly because the datagrid automatically make the words vertical displayed. Therefore, i wonder if we could solve it through making all the cells have the same fixed heigh/width??and how could we fix the height/width? i have tried to set it in the property builder, however, it does not work
Looking forward to ur reply, thanks in advance!
|
|
|
|
|
Try to use PreRender in DataGrid:
Private Sub grd_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles grdDefinitionList.PreRender
grd.Columns(1).ItemStyle.Width = Unit.Pixel(24)
grd.Columns(2).ItemStyle.Width = Unit.Pixel(24)
grd.Columns(3).ItemStyle.Width = Unit.Pixel(24)
End Sub
=postmaster
http://www.programmingknowledge.com/[^]
|
|
|
|
|
I m using Datagrid with Autogenerated Columns.
I want to set width of Autogenerated Columns.
I used that Code told by you.
But it is giving me error:
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
So can u explain me more and sort out this Problem...
Any help will be greatly appreciated...........
|
|
|
|
|
hi
you can set the width of any column in datagrid in html itself as below:
<asp:BoundColumn DataField="Id" HeaderText="Id" ItemStyle-Width=20%></asp:BoundColumn>
Prabir
|
|
|
|
|
Howerver, the datagrid is AutoGenerateColumn , then what could i do ??
|
|
|
|
|
hi,
then u need to do server side code what postmaster@programmingknowledge.com suggested previously.
Thanks,
Prabir
|
|
|
|