|
You can set the GridView.PageIndex and that should change the page for you. MSDN link[^]
|
|
|
|
|
You can direct set pageIndex property of the gridview in page load event like below code
GridView1.PageIndex = 2;
Page index starts from 0 so 2 will display page 3 in gridview.
Hope this might help you.
My DotNet Stuff
|
|
|
|
|
hello everyone!
There is a problem everyone would help.
In ASP.NET you want to display column color by number, while increasing the number of colors in the column increases.
Eg illustrations:http://www.cuocsongso.com/forum/attachment.php?attachmentid=11461&d=1302169075">
Please guide source
|
|
|
|
|
You've also asked this in Q&A: DO NOT CROSS POST!
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Hi,
Am using the following code to export data to excel
excelApp = new Microsoft.Office.Interop.Excel.ApplicationClass();
object oMissing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Workbook excelBook = excelApp.Workbooks.Open(excelFilePath, oMissing, false, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing);
Microsoft.Office.Interop.Excel.Worksheet excelSheet = (Microsoft.Office.Interop.Excel.Worksheet)excelBook.Sheets.Add(oMissing, oMissing, oMissing, oMissing);
the below error occurs
"Unauthorized access error.:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005."
|
|
|
|
|
Is it possible the file is read-only or otherwise not accessible by the IIS_User account?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Dim attachment As String = "attachment; filename=excel.xls"
Response.ClearContent()
Response.AddHeader("content-disposition", attachment)
Response.ContentType = "application/ms-excel"
Dim sw As New StringWriter()
Dim htw As New HtmlTextWriter(sw)
Dim frm As New HtmlForm()
GVLeo.Parent.Controls.Add(frm)
frm.Attributes("runat") = "server"
frm.Controls.Add(GVLeo)
frm.RenderControl(htw)
Response.Write(sw.ToString())
Response.End()
|
|
|
|
|
Response.ContentType = "Application/vnd.ms-excel";
Hope this will work for you.
|
|
|
|
|
Hi Beula,
This is ramkumar_cmots..Nice to c u in this forum... trying ur mobile no.. but it is not reachable
send ur mobile no to cyberramkumar@gmail.com
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
Hello everyone,
I am building an asp .net project and hosting on an XP Pro machine for a class project. For some reason random images decide not to load and it doesn't happen with any consistency. Sometimes one browser works better than another, sometimes they all work great. The only consistency is that when I click any one of the clickable images, the whole screen refreshes properly. Now nearly everything is wrapped up in update panels in the page but I don't see any reason why they wouldn't update properly. Does this ring a bell with anyone? Anyone have an idea what can cause this? Everything works perfectly in development (VS 2010, Win 7 64 Pro). I have tried disabling all anti-virus software and firewalls with no benefit.
Thanks to anyone who has read this far. And special thanks to anyone who has any suggestions.
FJ
|
|
|
|
|
fjaccarino wrote: hosting on an XP Pro machine
IIS installed in XP Pro is having some limitations like it will accept only a maximum of 10 connections simultaneously. This can be one reason of this weird behavior. Please use a proxy tool like fiddler (free from MS) for verifying the responses of broken images.
You may take any of the following steps.
1. Use sprite images instead of a lot of images.
2. Use caching of images at client side.
3. Use another OS (Windows 2003 server or similar) for hosting the site
Hope this helps.
"Never put off until run time what you can do at compile time."
- David Gries, in "Compiler Construction for Digital Computers", circa 1969.
|
|
|
|
|
guys;
I have worked on this article ^. and i have some proplems in the last code block ; if the calling button was a link button i can get the postback reference as easy as a peice of cake by getting the href,see
<a href="postback reference" />
but this doesnt work with image buttons and buttons with submit behavior
please help me on this becase i am stuck.
Help people,so poeple can help you.
|
|
|
|
|
Disclaimer: Company limitation requires me to code in classic asp and not .Net
Brain fried. I've tried rearranging this a million different ways and not getting the right result. What I want is, if the user selects "YES" on the message box, it redirects to another page. The actual message box appears fine, but I don't know how to pass that Yes variable to my code to redirect to the other page.
<%Dim DeckName, DeckNo
DeckName = Request.QueryString("DeckName")
DeckNo = Request.QueryString("DeckNo")
If Request.QueryString("Change") = "Y" then %>
<script language="VBScript">
Msgbox "Would you like to also update UMID Deck Rev Number?", vbYesNo
'And if the user selects Yes, then Response.Redirect("UMID_EditDeck.asp?DeckNum=" & DeckNo)
</script>
<% End If %>
Someone unscramble my brain, please.
----------------------------------
I'm not a programmer by trade, so please don't beat me unmerciful.
|
|
|
|
|
result=Msgbox "Would you like to also update UMID Deck Rev Number?", vbYesNo
If result = vbYes Then
Response.Redirect("UMID_EditDeck.asp?DeckNum=" & DeckNo)
Else
'Do what you want
End If
Is this what you are looking for? Sorry if I misunderstood your question, been a slow day here.
|
|
|
|
|
You can use javascript as well for this:
<%Dim DeckName, DeckNo
DeckName = Request.QueryString("DeckName")
DeckNo = Request.QueryString("DeckNo")
If Request.QueryString("Change") = "Y" then %>
<script type="text/javascript">
var r=confirm("Would you like to also update UMID Deck Rev Number?");
if (r==true)
{
window.location.replace("UMID_EditDeck.asp?DeckNum=<%=DeckNo%>");
}
}
</script>
<% End If %>
Om Prakash Pant
|
|
|
|
|
Hi, I am trying to read excel file uploaded by the user. So the excel sheet name varies by the user. So if I give particular sheet name, it is working fine but I want to get the sheet name automatically when the user uploads the excel file. The sheet name should be the name of the current sheet opened in the excel file. How to do that ?
For example:
if my code below is like this:
protected void ExcelConnection(string filename)
{
string xConnStr = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + Server.MapPath(Session["foldername"].ToString() + filename) + ";" + "Extended Properties=Excel 8.0;";
OleDbConnection objXConn = new OleDbConnection(xConnStr);
OleDbDataAdapter objDataAdapter = new OleDbDataAdapter();
string query;
grdViewUserIDs.DataSource = "";
try
{
objXConn.Open();
query = "select * from [Sheet1$]";
OleDbCommand objCommand = new OleDbCommand(query, objXConn);
objDataAdapter.SelectCommand = objCommand;
DataSet objDataSet = new DataSet();
objDataAdapter.Fill(objDataSet);
grdViewUserIDs.DataSource = objDataSet.Tables[0].DefaultView;
grdViewUserIDs.DataBind();
query = "";
objDataSet.Clear();
}
catch (Exception ex)
{
string t;
t = ex.ToString();
}
finally
{
objXConn.Close();
}
}
In the above code, how to replace [Sheet1$] with the current excel sheet name ?
suchita
|
|
|
|
|
Why don't you use the VS Tools for Office? They have all the code needed to open/manipulate/save Excel files 9and the resulting code would certainly be much cleaner than trying to do it with data adapters.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I haven't used VS Tools for office before. Can you please provide me some samples related to this.
Thanks,
Suchita
suchita
|
|
|
|
|
I would also suggest what John said. If for some reason you have to use OleDbConnection , you can use the GetOleDbSchemaTable method. Take a look at this
MSDN[^] link and this article[^].
|
|
|
|
|
I face this problem for a few day, after searching on google is still not help. Anyone help fix it. my fileupload control is not placed in updatepanel but it' hasFile properties still alway return false.
modified on Monday, April 18, 2011 12:03 PM
|
|
|
|
|
which version of Visual Studio you r using??
Some times textbox value and Fileupload value gets blank in Visual Studio 2008.
try to use
FileUp.Attribute.Add("Value",FileUp.PostedFile);
Hope this can help you.
|
|
|
|
|
hi Prasanta,
thanks for your response but i think problem is I'm using DarrenJohnst 's ASP.net FILEUPLOAD (http://darrenjohnstone.net/category/aspnet-file-uploads/) and i added some code in web.config and global
In Web.config :
<configuration>
<configSections>
<section name="uploadSettings" type="darrenjohnstone.net.FileUpload.UploadConfigurationSection, fileuploadlibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af961ece0b692dfb"/>
</configSections>
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="40960" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="5000" enableKernelOutputCache="true" enableVersionHeader="true" requireRootedSaveAsPath="true" enable="true" shutdownTimeout="90" delayNotificationTimeout="5" waitChangeNotification="0" maxWaitChangeNotification="0" enableHeaderChecking="true" sendCacheControlHeader="true" apartmentThreading="false"/>
<httpModules>
<add name="upload_module" type="darrenjohnstone.net.FileUpload.UploadModule, fileuploadlibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af961ece0b692dfb"/>
</httpModules>
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824">
</requestLimits>
</requestFiltering>
</security>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ScriptModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<remove name="upload_module"/>
<add name="upload_module" type="darrenjohnstone.net.FileUpload.UploadModule, fileuploadlibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af961ece0b692dfb"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UploadProgress" verb="GET" type="darrenjohnstone.net.FileUpload.UploadProgressHandler, fileuploadlibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af961ece0b692dfb" path="UploadProgress.ashx"/>
<add name="FileDownload" verb="GET" type="darrenjohnstone.net.FileUpload.SQLFileDownloadHandler, fileuploadlibrary, Version=2.0.0.0, Culture=neutral, PublicKeyToken=af961ece0b692dfb" path="DownloadFile.ashx"/>
</handlers>
</system.webServer>
</configuration>
and Here is My Global code :
void Application_Start(object sender, EventArgs e)
{
darrenjohnstone.net.FileUpload.UploadManager.Instance.ProcessorType = typeof(darrenjohnstone.net.FileUpload.DummyProcessor);
darrenjohnstone.net.FileUpload.UploadManager.Instance.ProcessorInit += new darrenjohnstone.net.FileUpload.FileProcessorInitEventHandler(Processor_Init);
}
void Processor_Init(object sender, darrenjohnstone.net.FileUpload.FileProcessorInitEventArgs args)
{
}
void Application_End(object sender, EventArgs e)
{
}
void Application_Error(object sender, EventArgs e)
{
}
void Session_Start(object sender, EventArgs e)
{
}
void Session_End(object sender, EventArgs e)
{
}
anyone give some solution to fix it thanks.
|
|
|
|
|
i have to import xml document having size more than 10GB in Sql Server database. i also have to do XSD Validation before Processing and maintain transaction. Please suggest me the best way to do the same. should i use SSIS packege? is it capable of Processing such large document? or Do i have to use c# coding to accomplish this task?
modified on Monday, April 18, 2011 6:12 AM
|
|
|
|
|
man! you have also posted this in C# as well as database forums. do not post it again everywhere.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
This has absolutely nothing to do with ASP.NET
I know the language. I've read a book. - _Madmatt
|
|
|
|
|