|
i wanna ask about control enable me to display article this article could be
word , pdf or html file and this article must be in aportion of my page not in all the page i hope u understand my request
rasha
|
|
|
|
|
I don't know of such a control which allows to do this thing, and also basically you cannot display the contents of the word, pdf documents as part of the web page except you use the iframe element. If you mean you want to mix up the contents of the web page and the article , you may think of converting the article contents to the html markup, then output to the web page.
|
|
|
|
|
i think u r asking about open word,excel file
for that u have no need for any control
just give the path of the file and open in new window
Mahendra
|
|
|
|
|
Just learning asp.net and have a basic question.
I have a list of records that I want to display 10 at a time. I have the SQL for it but how should I do in ASP.net to send the offset where I'm currently at?
Code:
Private mNofRows As Integer = 10<br />
Private mOffset As Integer = 0<br />
<br />
Private Sub AddNavigationHandlers()<br />
Dim vLinkButtonPrev As LinkButton = DirectCast(Me.Form.FindControl("EntryNavigationPrev"), LinkButton)<br />
Dim vLinkButtonNext As LinkButton = DirectCast(Me.Form.FindControl("EntryNavigationNext"), LinkButton)<br />
AddHandler vLinkButtonPrev.Click, AddressOf EntryNavigationPrev_Click<br />
AddHandler vLinkButtonNext.Click, AddressOf EntryNavigationNext_Click<br />
<br />
vLinkButtonPrev.Enabled = mOffset > 1<br />
End Sub<br />
<br />
Public Sub EntryNavigationPrev_Click(ByVal pSender As Object, ByVal pEventArgs As System.EventArgs)<br />
mOffset -= mNofRows<br />
GetRecords(mOffset, mNofRows)<br />
End Sub<br />
<br />
Public Sub EntryNavigationNext_Click(ByVal pSender As Object, ByVal pEventArgs As System.EventArgs)<br />
mOffset += mNofRows<br />
GetRecords(mOffset, mNofRows)<br />
End Sub
I was hoping that I could have the member variables set at first time and then use them as shared to retain the value between postbacks, but this doesn't seem to work.
Should I be using the tag property of the LinkButtons?
Should I be saving the value in a session variable?
Should I be saving the value in a hidden control?
Should I be saving the value server side using a session object to hold the business tier object with state?
|
|
|
|
|
Hi,
The best place for is when calling the SQL in the first instance, for example, your sql/stored procedure should only return 10 records instead of return all the record(s).
|
|
|
|
|
I think you missunderstood me.
My SQL supports 2 parameters, number of records to return and offset from where to return records. EX: Nof=10, Offset=10 will return records 10-19. I will olny return the number of records that I need from the data-tier.
My question is when hitting the linkbutton "next 10 records" and the postback fires, how do I remember the offset variable. For each time I press the "next 10 records" I want to offset counter to increment by 10.
In old ASP I would have submitted the Offset parameter as an appended querystring parameter:
Ex: <a href="List10Records.asp?intOffset=10">next 10 records</a> . How should I do in ASP.net 2.0?
|
|
|
|
|
use page data source. It has currentindex property.
I hope this help you.
Amit
|
|
|
|
|
I should say that I'm not using databinding.
I'm surprised that I havn't got more replies to this as I thought that this would be a simple question.
I will look at the page data source control but I see this as a more general question, to retain a value between postbacks.
I tought the whole idea with code behind was to allow the programmer to utilize more of the same programing thechniques as when writing a WinForms application. I'm surprised that ASP.net cannot handle member variables. Why arenä't these stored and re-initalized by the view state as a controls properties?
|
|
|
|
|
Hi guys
What is wrong with this ReportPath: /Pages/ReportViewer.aspx?Website+Reportingfvisits&rs:Command=Render
FYI: ReportServerUrl: http://server/ReportServer/
I get the following error: The path of the item "/Pages/ReportViewer.aspx?Website+Reportingfvisits&rs:Command=Render" is not valid. The path must be less than 260 characters long and must start with slash. Other restrictions apply. (rsInvalidItemPath)
|
|
|
|
|
HOw can add new record with ASP.NET without using SQL Statement and Dataset?
Thanks
................
|
|
|
|
|
|
Let me explain.
GetExcludeFolder() - Gets from XML folders that has to be excluded, that's ok.
To enable paging, first I have to fill the array and then display the data from an array as I did in foreach.
The problem code is if statesment.
It says if s.Name doesen't have any string that GetExcludeFolder() returns, then fill the array with this folder name otherwise dont fill array.
When I run this, I get all folder from wwwroot.
Iam confused, what Iam doing wrong?
protected override void Render(HtmlTextWriter writer)
{
int i = 0, j = 0;
DirectoryInfo dir = new DirectoryInfo(@"f:\inetpub\wwwroot\");
DirectoryInfo[] d = dir.GetDirectories("*");
foreach (DirectoryInfo s in d)
{
if (s.Name.IndexOf(GetExcludeFolder()) == -1)
{
directory[i, j] = s.Name.ToString();
directory[i, j + 1] = s.CreationTime.ToString();
i++;
}
}
Response.Write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"1\" width=\"100%\">");
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px; width: 50%;\">Folder name");
Response.Write("</td>");
Response.Write("<td style=\"height: 25px; width: 50%;\">Date created");
Response.Write("</td>");
Response.Write("</tr>");
j = 0;
for (i = currentPage * pageSize - pageSize; i < currentPage * pageSize; i++ )
{
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px;\"><a href=\"http://localhost/" + directory[i, j] + "/\">" + directory[i,j]);
Response.Write("</a></td>");
Response.Write("<td style=\"height: 25px;\">" + directory[i,j + 1]);
Response.Write("</td>");
Response.Write("</tr>");
}
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px\" colspan=\"2\">");
Response.Write("1 2 3");
Response.Write("</td>");
Response.Write("</tr>");
Response.Write("</table>");
}
|
|
|
|
|
You use a lot of variables that you (hopefully?) have defined outside the method. For instance, where, when and how do you create the directory array?
What does the GetExcludeFolder() method return? Why do you use IndexOf to compare it with the Name property?
---
b { font-weight: normal; }
|
|
|
|
|
I said above what returns GetExcludeFolder()
GetExcludeFolder() - Gets from XML folders that has to be excluded, that's ok.
directory array is declared global to the class, like pageSize and currentPage.
I use IndexOf to see what folders I don't need to enter into the array so it checks if a s.Name is comprehended in string that GetExcludeFolder returns.
If so, don't add that folder name into the array.
One more thing. String that returns GetExcludeFolder is something like: aspnet_client;_vti_cnf;vti_pvt;_vti_script;_vti_text;
Hope this is understandable.
|
|
|
|
|
Kasic Slobodan wrote: I said above what returns GetExcludeFolder()
GetExcludeFolder() - Gets from XML folders that has to be excluded, that's ok.
That information is not clear enough to determine the cause of the error. If the method actually returns more than one folder name, then your code doesn't make sense. That's also why I asked why you are using IndexOf.
Kasic Slobodan wrote: One more thing. String that returns GetExcludeFolder is something like: aspnet_client;_vti_cnf;vti_pvt;_vti_script;_vti_text;
Then you should look in that string for the folder name, not the other way around.
---
b { font-weight: normal; }
|
|
|
|
|
One more thing. String that returns GetExcludeFolder is something like: aspnet_client;_vti_cnf;vti_pvt;_vti_script;_vti_text;
Then your code is basically running the following...
if (s.Name.IndexOf("aspnet_client;_vti_cnf;vti_pvt;_vti_script;_vti_text;") == -1)
{<br />
directory[i, j] = s.Name.ToString();<br />
directory[i, j + 1] = s.CreationTime.ToString();<br />
i++;<br />
}
It's looking for the entire string of 'aspnet_client;_vti_cnf;vti_pvt;_vti_script;_vti_text;' inside your folder name for each folder and obviouly not finding it, and thus return ALL directories. You need to put the excluded folder names in some form of array then iterate through the array inside your foreach (DirectoryInfo s in d) checking ifthe current directory has been excluded. Hope that makes sense.
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
Here's a rewrite of your code....
protected override void Render(HtmlTextWriter writer)
{
int i = 0, j = 0;
DirectoryInfo dir = new DirectoryInfo(@"f:\inetpub\wwwroot\");
DirectoryInfo[] d = dir.GetDirectories("*");
String[] excludedFolders = { "aspnet_client", "_vti_cnf", "vti_pvt", "_vti_script", "_vti_text" };
foreach (DirectoryInfo s in d)
{
foreach(String folderToExclude in excludedFolders)
{
if (s.Name.IndexOf(folderToExclude) == -1)
{
directory[i, j] = s.Name.ToString();
directory[i, j + 1] = s.CreationTime.ToString();
i++;
}
}
}
}
There may be a better way to write it rather than use multiple nested for loops, but that should work.
The 'excludedFolders' String array could get it's contents from your function ie.
String[] excludedFolders = GetExcludeFolder();
...making sure GetExcludeFolder() method returns an array of strings.
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
@ Guffa
When I write if like: if (GetExcludeFolder().IndexOf(s.Name) == -1)
then all folder that GetExcludeFolder return arent added to array except two.
Iam confused, becouse I have done this planty of time, but reverse, not to exclude, but to include and this worked perfectly with the IndexOf method.
I don't know why that doesent work.
This is that method i was telling you about:
tFileTypes.Text = .zip;.rar;.exe;
and this is if
if (tFileTypes.Text.IndexOf(fi.Extension.ToString()) >= 0) // fi is in foreach, FileInfo
And this works. Its the same method, but the other condition.
I will use your code becouse I dont have a patience to experiment anymore.
Thank you both.
|
|
|
|
|
When I write if like: if (GetExcludeFolder().IndexOf(s.Name) == -1)
then all folder that GetExcludeFolder return arent added to array except two.
That should work, maybe want to check the string variable contents, maybe a space or something is being added somewhere it shouldn't, does your IDE (Visual Studio etc) have a debugger?
The only problem with that though is that the GetExcludeFolder() method is being called multiple times, once in each 'foreach' loop depending on how many directories there are. If the 'GetExcludeFolder()' method is fairly resource intensive (reading the file system for instance), the code I gave you using string arrays may be more efficient since 'GetExcludeFolder()' method is only being called once.
Good luck!
Sunday Ironfoot
www.dominicpettifer.co.uk (work in progress)
|
|
|
|
|
What folders are excluded that you think should be included?
---
b { font-weight: normal; }
|
|
|
|
|
I made a typo when I said that there is folders that are excluded, but it's not.
There is no directory named vti_pvt and _vti_text it should be _vti_pvt and _vti_txt .
Small typeo's, but makes a hell of a project .
I did a detailed debug nd saw this irregularity.
I did listen to Ironfoot and move GetExcludedFolder() out of the foreach.
But I didn't do as Ironafoot said with two for's becouse it would be hard to create an array from one string that is read from Xml.
Replaced array with ArrayList becouse I need dynamic array and now code, that works, looks like this:
protected override void Render(HtmlTextWriter writer)
{
string tmp = GetExcludeFolder();
int i = 0;
DirectoryInfo dir = new DirectoryInfo(GetWwwRootFolder());
DirectoryInfo[] d = dir.GetDirectories("*");
foreach (DirectoryInfo s in d)
{
if (tmp.IndexOf(s.Name) == -1)
{
directory.Add(s.Name.ToString());
date.Add(s.CreationTime.ToString());
i++;
}
}
Response.Write("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">");
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px; width: 50%;\">Folder name");
Response.Write("</td>");
Response.Write("<td style=\"height: 25px; width: 50%;\">Date created");
Response.Write("</td>");
Response.Write("</tr>");
for (i = currentPage * pageSize - pageSize + 1; i <= currentPage * pageSize; i++ )
{
if (i >= directory.Count)
break;
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px;\"><a href=\"http://localhost/" + directory[i - 1] + "/\">" + directory[i - 1]);
Response.Write("</a></td>");
Response.Write("<td style=\"height: 25px;\">" + date[i - 1]);
Response.Write("</td>");
Response.Write("</tr>");
}
Response.Write("<tr>");
Response.Write("<td style=\"height: 25px\" colspan=\"2\"><div align=\"" + GetPagingAlign() + "\" id=\"CustomPageAlign\">");
Response.Write("Choose page: ");
int mat = (int)Math.Ceiling((decimal)directory.Count / pageSize);
for (i = 1; i <= mat; i++)
{
if (i == currentPage)
{
Response.Write(i + " | ");
}
else
{
Response.Write("<a href=\"Default.aspx?Page=" + i + "\">" + i + "</a> | ");
}
}
Response.Write("</div></td>");
Response.Write("</tr>");
Response.Write("</table>");
}
It always helps me to see a bug if I talk to someone (forums, mails, etc.). I get a good code's that I can use and with talking, I can see some bugs that I could never see if I wasn't wrote this thread and ask you.
Thank you both for your time. I appreciated.
|
|
|
|
|
How do i upload images on to specified web pages?
thank you
Nothing lasts but nothing is lost
|
|
|
|
|
|
|
Hi
I have 2 chekboxes and a submit button in asp.net 2.0
on first checkbox onclick event i wrote a javascript , that will check the other checkbox to true and disable it.
now when i submit the page , before submmiting the page i get the other check box as checked = false; but acctually i have done it checked= true; using javasccript
please help why this is happening as i need to the other checkbox as checked = true using javascript
deepak
|
|
|
|