|
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.
|
|
|
|
|
Dear All,
I am having a datagrid with Edit, Update, and Delete button columns and bound columns on my asp.net form, what i want to do is that when there is a value in a datagrid cell, then disable the Delete button.
For example:
if there is a value in DateReceived cell, the Delete button on that data row will be disabled, and if there is no value in DateReceived cell, the Delete button on that data row will be enabled.
I knew that i might need to use DataGrid ItemDataBound event, the following code disable the Delete button unless the Edit button been clicked, but this is not what i want.
private void dgrOrders_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
DataGridItem dgi = e.Item;
if ((dgi.ItemType == ListItemType.Item) || (dgi.ItemType == ListItemType.AlternatingItem))
{
LinkButton lb = (LinkButton)e.Item.Cells[11].Controls[0];
if (lb != null && lb.CommandName.Equals("Delete"))
{
lb.Enabled = false;
}
}
}
Can someone please shed a light in here for me, thanks heaps.
Andie
|
|
|
|