|
Hi guys i have a doubt in file directory...,
i am getting all the files which is in a partcular folder and binding in to my dropdown listbox...,
for this i wrote this code:
FileInfo fi = new FileInfo(Server.MapPath("../admin/Templates/Markets/"));
DirectoryInfo di = fi.Directory;
FileSystemInfo[] fsi = di.GetFiles();
ddlpagename.DataSource = fsi;
ddlpagename.DataBind();
Now my question is:
my folder contained all kind of file types...,
in that i wnt to bind only .htm/.html files only...,
how to get a particular file type in a particular directory and bind in to dropdown list?
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
One Sample Example for you
using System;
using System.IO;
class Program
{
static void Main()
{
string filePath = @"C:\Users\Abhijit\Test.html";
string exten = Path.GetExtension(filePath );
if (exten == ".html")
{
}
}
}
Hope this will help you to move ahead
|
|
|
|
|
Hi abhijit thanks for ur reply,
but i amn't using a particular file...,
its collections of files need to bind in dropdownlist...,
is there anyother wau to achieve it?
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Member 3879881 wrote: but i amn't using a particular file...,
its collections of files need to bind in dropdownlist...,
Yeah that I know. I have gave you the idea how to implement it. As there is a single file, you can do the same for File Collection also in a for-each.
|
|
|
|
|
try this
private static void RemoveDuplicateItems(DropDownList ddl)
{
for (int i = 0; i < ddl.Items.Count; i++)
{
ddl.SelectedIndex = i;
string str = ddl.SelectedItem.ToString();
for (int counter = i + 1; counter < ddl.Items.Count; counter++)
{
ddl.SelectedIndex = counter;
string compareStr = ddl.SelectedItem.ToString();
if (str == compareStr)
{
ddl.Items.RemoveAt(counter);
counter = counter - 1;
}
}
}
}
and bind it like this
private void Bind_Restore_Combo()
{
DirectoryInfo dir = new DirectoryInfo(@"C:\DATABASES\");
FileInfo[] files = dir.GetFiles();
foreach (FileInfo file in files)
{
if (file.Extension == ".htm" && file.Extension != ".html")
{
cmbrestore.Items.Add(Convert.ToString(file.Name));
RemoveDuplicateItems(cmbrestore);
}
}
}
This will help
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
|
I guess, this is the problem due to binding the data on girdview during Postback. You have binded the data at Page_Load and you didn't check the IsPostBack Property.
|
|
|
|
|
Yeah i have written bindgrid inside(!IsPostback)
|
|
|
|
|
I have a gridView on my page. How do I insert the contents of the gridView to sql database? My database table is empty at the moment.
|
|
|
|
|
check this
http://www.dotnetfunda.com/articles/article71.aspx[^]
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Loop all cells foreach row,when looping ends then save data in database.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
www.aktualiteti.com
|
|
|
|
|
There are various way to do it. Its depends what is your current DataSource Type.
|
|
|
|
|
Hi all,
Im uploading a img gif( type gif animated). but it is saved as (type gif).why it isconverted as such . how to avoid it.
|
|
|
|
|
I dont really understand what is your problem
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Im uploading a gif animated image with 3 frames. but the image is not saved as animated one.I think 1 frame is saving other frames are not there. When i see the image properties i come to know that the image is saved as gif image not as gif image (animated). how to solve it . Can u get me now..
|
|
|
|
|
There is no Differents between the two. try to view the Gif without putting it in your page and see if it changes the images
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I found that from my application path. It is not animated outside also.The image is resized while saving . The resized image is may be the reason for this.Is there any possibility for this...
|
|
|
|
|
I got it Mr.Maseko. My guess is right. Resizing is the problem here.
|
|
|
|
|
ok Am glad you find the solution
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
<asp:menu id="menuTabs" runat="server" orientation="Horizontal" staticselectedstyle-cssclass="selectedTab" staticmenuitemstyle-cssclass="tab" cssclass="menuTabs" onmenuitemclick="menuTabs_MenuItemClick">
<items>
<asp:menuitem
text="VTT"
="" value="0" selected="true">
<asp:menuitem
text="Radar"
="" value="1">
<asp:menuitem
text="Laser"
="" value="2">
//solution
if you want to hide the 'laser' item, do this:
How can i do this?
Thanks in Advance.
|
|
|
|
|
<asp:MenuItem
Text="VTT"
Value="0"
Selected="true" />
<asp:MenuItem
Text="Radar"
Value="1"/>
<asp:MenuItem
Text="Laser"
Value="2"/>
Just visible="false"
try and try untill reach success..
|
|
|
|
|
no visible properties in MenuItem
|
|
|
|
|
Hi,
I have a gridview with paging. I need to print all the data in the gridview...not only the displayed page.
Also, if the grid contains only some of the data and the rest will come only when the user clicks on the last page number, printing should print all the other data that the datasource contains.
Please help.
|
|
|
|
|
|
I have got the solution...Not from the post you mentioned . It was the excat thing I wanted.
|
|
|
|