|
hii....
i m reading a table through datareader.it reads a single row but next time it comes out of loop even when there
is a row in table.
the code is..
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Jajaipur"].ConnectionString);
SqlDataReader dr = null;
//SqlDataReader dr2 = null;
string str = "SELECT MenuId, Menu FROM Menu ";
SqlCommand cmd = new SqlCommand(str, conn);
conn.Open();
dr = cmd.ExecuteReader();
Response.Write("");
while (dr.HasRows != null)
{
dr.Read();
String id = dr["MenuId"].ToString();
String str1 = dr["Menu"].ToString();
int i = Convert.ToInt32(id);
Response.Write("- ");
Response.Write(str1);
TextBox1.Text = TextBox1.Text+ str1;
conn.Close();
string str2 = "SELECT MenuId, SubMenuID, SubMenu FROM SubMenu where (MenuId = " + i + ")";
SqlCommand cmd2 = new SqlCommand(str2, conn);
//SqlDataReader dr2 = null;
conn.Open();
dr = cmd2.ExecuteReader();
Response.Write("");
while (dr.Read())
{
String str3 = dr["SubMenu"].ToString();
Response.Write("- ");
Response.Write(str3);
Response.Write(" ");
}
Response.Write(" ");
Response.Write(" ");
}
Response.Write(" ");
conn.Close();
|
|
|
|
|
KhandelwalA wrote: while (dr.HasRows != null)
{
dr.Read();
Try this
While(dr.Read())
{
}
|
|
|
|
|
Hello every one.............i m developing a shopping cart website. and i am creating ajax tab container to show product specifications, comparisons,etc with multiple tab index. Is it possible to show specific Active tab index when user redirects to this page from another page like if user clicks on Specification, then it should be active and for Comparisons show comparisons tab etc..........plz guide me.
|
|
|
|
|
You need to send ActiveTabIndex Property
ActiveTabIndex=TabId
Hope this will help you
|
|
|
|
|
Dear All,
In my web application, I have a IFRAME in a web page.
When the user previews a document it is loaded in the IFRAME.
When the user places the cusrsor outside the IFRAME in the page and presses "ESC" key, it closes the IFRAME.
Can any one tell me how to get rid of this issue.
Thanks a lot in advance
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
M. J. Jaya Chitra wrote: When the user places the cusrsor outside the IFRAME in the page and presses "ESC" key, it closes the IFRAME.
You are using any div for place the IFrame? Can you please show us the code?
|
|
|
|
|
Dear Jana,
Yes it is inside the div tag only below is the code for the same:
<div id="divPDF" runat="server" visible="false">
<iframe id="PDFframe" runat="server" style="height: 410px; width: 100%; overflow: auto;"
frameborder="0" scrolling="auto"></iframe>
</div>
The code behind is:
divFilter.Visible = false;
divPDF.Visible = true;
lnkBackToFilters.Visible = true;
PDFframe.Attributes["src"] = "ReportPDF.aspx";
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
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.
|
|
|
|