|
Hello!
I'm trying to find a code to delete multiple columns because when you delete a column the next column takes his place so for example:
If you delete column 6 then column 7 becomes column six.
I tried the following code with an for loop & a while loop:
Dim field As DataControlField = gv.Columns(i)
gv.Columns.Remove(field)
&
gv.columns.removeat(i)
But same case that the column 7 becomes column 6
The variable removeColumns is an array with the column number that need to be deleted.
If wanted I can also provide the Header Names
Thanks a lot for anyone who can Help me!
Imports System.Data
Imports System.Configuration
Imports System.IO
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Public Class GridViewExportUtil
Public Shared Sub Export(ByVal fileName As String, ByVal gv As GridView, ByVal removeColumns As Integer())
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", fileName))
HttpContext.Current.Response.ContentType = "application/ms-excel"
'Gridview column delete code should come here
Using sw As New StringWriter()
Using htw As New HtmlTextWriter(sw)
' Create a form to contain the grid
Dim table As New Table()
' add the header row to the table
If gv.HeaderRow IsNot Nothing Then
GridViewExportUtil.PrepareControlForExport(gv.HeaderRow)
table.Rows.Add(gv.HeaderRow)
End If
' add each of the data rows to the table
For Each row As GridViewRow In gv.Rows
GridViewExportUtil.PrepareControlForExport(row)
table.Rows.Add(row)
Next
' add the footer row to the table
If gv.FooterRow IsNot Nothing Then
GridViewExportUtil.PrepareControlForExport(gv.FooterRow)
table.Rows.Add(gv.FooterRow)
End If
' render the table into the htmlwriter
table.RenderControl(htw)
' render the htmlwriter into the response
HttpContext.Current.Response.Write(sw.ToString())
HttpContext.Current.Response.[End]()
End Using
End Using
End Sub
|
|
|
|
|
Hi All,
We use Paypal in our asp.net(c#) application like this.
" />
when the transcation is sucessfull... how to get the transcation id to check the status?
Please help
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
When your transaction is successful you will receive 'txn_id' variable from Paypal where you can find your transaction.
|
|
|
|
|
Thank..
Could you be still clear to me..
how to access txn_id ..I need to save in my local DB.
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
When your payment successful PayPal post data to your success URL.
Now here PayPal post different variables to this URL .
The 'txn_id' is one of those variable PayPal post in success url.
So you need to get that variable with Request object and you will get Transaction ID.
Hope this Help.
|
|
|
|
|
It works.. Thanks for your support.
I have another issue in testing in sandbox.
when i run the page, it showing me
"Please login to use the PayPal Sandbox features."
and offen getting cookie issue.
apologize for asking all silly things.
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
I want to make function.
If i upload video file or flash in somewhere.
Client pc can see popup windows which can show video or flash.
So, ASP.net can do?
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
buffering83 wrote: So, ASP.net can do?
Yes it can.
You need to use HTML <object> tag to link this video.
|
|
|
|
|
Oh, Thank you!
This is what i want!!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Hi all,
I have the Textbox inside Update Panel like below
<td colspan="4" style="border: none;">
<asp:UpdatePanel ID="upnl_PeriodYears" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:TextBox ID="txtPeriodFromDate" runat="server" Width="90px" ValidationGroup="LandAcqForm" Text='<%#(((System.Data.DataRowView)Container.DataItem).DataView.Table.Columns.Contains("DBFromDate")? Eval("DBFromDate") : "FromDate") %>'></asp:TextBox>
But iam getting the below error
CS1061: 'System.Web.UI.Control' does not contain a definition for 'DataItem' and no extension method 'DataItem' accepting a first argument of type 'System.Web.UI.Control' could be found (are you missing a using directive or an assembly reference?)
How i assign the value to Textbox which is inside Update Panel???
Regards
|
|
|
|
|
|
Cool, god bless Google, gonna get that in mind, just a question... an update panel is used for what? to retrieve data from table and refresh it, in order to keep it updated ? like doing it with AJAX?
Thanks!
|
|
|
|
|
msqar wrote: just a question... an update panel is used for what? to retrieve data from table and refresh it, in order to keep it updated ? like doing it with AJAX?
Here you go....simple & explained nicely
What is the UpdatePanel in ASP.NET Ajax?[^]
BTW you welcome
|
|
|
|
|
Hi All,
I need to integrate Paypal with my web site(asp.net with c#)
I created paypal sandbox account, but still do not have clear idea of how to integrate.
Please help me with...
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
|
Hi,
Check this out http://www.asp.net/downloads/starter-kits/paypal-ecommerce/
OR
You need a paypal account and you have to sign up for a business account so you can accept credit card payments.
There are some clever ways to integrate it but I have illustrated one of the most basic ways here:
http://runtingsproper.blogspot.com/2009/07/simple-paypal-button.html
That would get you going with a purchasable item. You will have to dig deeper if you want to add items to a cart and then purchase them all at once.
There is a dedicated developer network called the PayPal Developer Network.
https://www.paypal.com/developer
http://developer.paypal-portal.com/pdn/
And many many tutorials out there:
http://www.google.co.uk/search?q=asp.net+paypal
Hope it helps
Regards
|
|
|
|
|
|
Hi,
I have created a sample login site using SQL membership provider and authentication and authorization.
The admin folder has a default.aspx and in the web config I have denied access to users who are not of role admin and any other user. When I run the code with the admin/default.aspx as start page locally, it works fine by redirecting me to login page. However on publish when I type in www.domainname.com/admin/default.aspx, I get the error that "The website declined to show this webpage, Most likely causes:This website requires you to log in.". How can I make it redirect to login page.
Thanks
|
|
|
|
|
What settings have you applied to the web.config in your production environment?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Here is a part of the web config file from the production:
<authentication mode="Forms" >
<forms loginUrl="login.aspx" >
</forms>
</authentication>
<authorization>
<allow roles="Admin, Employee"/>
<deny users="*"/>
</authorization>
</system.web>
<location path="Admin">
<system.web>
<authorization>
<allow roles="Admin"/>
<deny roles="Employee"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
Why does it work in development and not when published. I havent changed any settings from development to publish accept the database connection string.
|
|
|
|
|
ok.. I changed the setting for the admin folder from deny users "*" to deny users"?" and it worked.
<location path="Admin">
<system.web>
<authorization>
<allow roles="Admin"/>
<deny roles="Employee"/>
<deny users="?"/>
</authorization>
</system.web>
what is the difference between * and ?.
|
|
|
|
|
Reading the documentation helps to answer questions like this. * means all, ? means only authenticated
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
i got error : Invalid column name 'A1009'.
chk1 = "select Sno from Student where SID = "+ @smemno.Text.ToString();
SqlCommand ck1 = new SqlCommand(chk1, cn);
v11 = (string)ck1.ExecuteScalar();
what should i do?
|
|
|
|
|
Paresh1462 wrote: what should i do?
Realize that we are not looking over your shoulder. Give an accurate description of the conditions, your problem, expected outcome and what you have tried.
Without knowing your database structure or what it is populated with how can we tell what column A1009 means?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
chk1 = "select Sno from Student where SID = '"+ @smemno.Text.ToString()+"'";
will probably fix it, but as Mark said, more details would help tremendously.
|
|
|
|