|
Still not got solution.
Can U explain This.
kartik rathi
|
|
|
|
|
Here is a code snippet of the code that works for sorting. Please change the Connection string and the querys. If you are using Atlas for ajax put the full thing inside the <atlas:updatepanel><contentpanel>. That will do the job.
<asp:gridview id="GridView1" runat="server" allowpaging="True" allowsorting="True"
="" autogeneratecolumns="False" datakeynames="CategoryId" datasourceid="SqlDataSource1">
<columns>
<asp:commandfield showdeletebutton="True" showeditbutton="True">
<asp:boundfield datafield="CategoryId" headertext="CategoryId" insertvisible="False"
="" readonly="True" sortexpression="CategoryId">
<asp:boundfield datafield="Category" headertext="Category" sortexpression="Category">
<asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:VikramConnectionString %>"
="" deletecommand="DELETE FROM [Category] WHERE [CategoryId] = @CategoryId" insertcommand="INSERT INTO [Category] ([Category]) VALUES (@Category)" selectcommand="SELECT [CategoryId], [Category] FROM [Category]" updatecommand="UPDATE [Category] SET [Category] = @Category WHERE [CategoryId] = @CategoryId">
<deleteparameters>
<asp:parameter name="CategoryId" type="Int32">
<updateparameters>
<asp:parameter name="Category" type="String">
<asp:parameter name="CategoryId" type="Int32">
<insertparameters>
<asp:parameter name="Category" type="String">
vikram lakhotia
|
|
|
|
|
I want to do sorting in Grid View with help of coding.This is my code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
getdata()
End Sub
Public Function getdata() As DataSet
Dim adp As New SqlDataAdapter("select CategoryID,CategoryName,Description from categories order by CategoryName ASC", ConfigurationManager.ConnectionStrings("cn").ConnectionString)
Dim dt As New DataTable("categories")
adp.Fill(dt)
Dim dtrowcount As Integer = dt.Rows.Count
If dtrowcount > 0 Then
GridView1.DataSource = dt
GridView1.DataBind()
End If
End Function
Private Property GridViewSortDirection() As String
Get
Return IIf(ViewState("SortDirection") = Nothing, "DESC", ViewState("SortDirection"))
End Get
Set(ByVal value As String)
ViewState("SortDirection") = value
End Set
End Property
Private Property GridViewSortExpression() As String
Get
Return IIf(ViewState("SortExpression") = Nothing, String.Empty, ViewState("SortExpression"))
End Get
Set(ByVal value As String)
ViewState("SortExpression") = value
End Set
End Property
Private Function GetSortDirection() As String
Select Case GridViewSortDirection
Case "ASC"
GridViewSortDirection = "DESC"
Case "DESC"
GridViewSortDirection = "ASC"
End Select
Return GridViewSortDirection
End Function
Protected Function SortDataTable(ByVal datatable As DataTable, ByVal isPageIndexChanging As Boolean) As DataView
If Not datatable Is Nothing Then
Dim dataView As New DataView(datatable)
If GridViewSortExpression <> String.Empty Then
If isPageIndexChanging Then
dataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GridViewSortDirection)
Else
dataView.Sort = String.Format("{0} {1}", GridViewSortExpression, GetSortDirection())
End If
End If
Return dataView
Else
Return New DataView()
End If
End Function
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
GridView1.DataSource = SortDataTable(GridView1.DataSource, True)
GridView1.PageIndex = e.NewPageIndex
GridView1.DataBind()
End Sub
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
GridViewSortExpression = e.SortExpression
Dim pageIndex As Integer = GridView1.PageIndex
GridView1.DataSource = SortDataTable(GridView1.DataSource, True) GridView1.DataBind()
GridView1.PageIndex = pageIndex
End Sub
I had received an error on Bold line in gridview1_sorting procedure that Unable to cast system.data.dataset to system.data.dataview
Can any body give me solution.
Thanks in advance.
Kartik Rathi
|
|
|
|
|
|
Thanks for your great help.
kartik rathi
|
|
|
|
|
hi
I want to generate reports on asp.net,but problem is this ,suppose my database table having 20 colouns,and i have selected only 4 or 10 coloumns on runtime for reports, so how can i generate reports on the basis of thi ype of conditon,please help as soon as
thanks
prabhakar dwivedi
|
|
|
|
|
What kind of reporting tool are you using? Or you are showing by HTML only?
Ram
|
|
|
|
|
hello,
I have to use the paypal and 2checkout.com for payment.
any body hav real time example code for it.
or anybody can tell me the steps for it.
thanx
|
|
|
|
|
www.paypal.com has all the info you need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have seen the paypal.com before this too and i hav dowload the SDk too for paypal.
but not getting the how to configure and how to send the variable from my iste to paypal and how to recieve the variables.
waiting for the reply
thanx
|
|
|
|
|
Which part of the explanation on the paypal site are you having trouble with ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Have you tried Paypal support?
- ashish
|
|
|
|
|
Hi,
I don't think anyone can access paypal for verification, we have to get a subscribtion to use paypal. Then there may be some web services available in paypal.com, there we need to send variables and that web method verify our input and provide output, better to get touch with paypal support.
Ram
|
|
|
|
|
how can i achieve the
Auto Save feature using Ajax to my webpage.
when any user fill the form then it must be Autosave in every 10 sec. using Ajax just like in gmail draft option.
how to do this.
thanx
|
|
|
|
|
Have you used Ajax before ? Read up on it ? Know what it is ? Have you downloaded ATLAS ? Or are you stabbing in the dark ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hello
thanx for replying for this thread too.
fraknly speaking, i didn't work on Ajax before. but i have read the tut. of the Ajax and now i'm aware of it.
but not getting how to do it.
should i have to use ATLAS for it.
i'm using Asp.net 1.1 and as much as i know Atlas does not work on Asp.Net1.1.
tell me how can i do it.
thanx
|
|
|
|
|
OK, I have no idea what support exists for 1.1.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
i have to add javaScript stats Code to every page of my site Like google Analytics.
how to do this.
thanx
|
|
|
|
|
Are all these questions for the same site ? Have you tried to do any of these things, or are you hoping for complete solutions based on your brief descriptions ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello
thanx for the reply.
yes all these question are related for the same site.
and i have tried for the Google Analystics from this Link.
https://www.google.com/analytics/home/provision?vid=1000.
but My Client have given me a Chart control for doing it mannualy.
can i do it mannualy or i have to use google Analystics for it.
thanx i hope now u will get my question and will help me.
|
|
|
|
|
I have one web user control which consists of one Button web control.
I have 3 aspx pages in which i have to use this web user control. But when iam going to click on the button it should perform different actions in different aspx pages.
|
|
|
|
|
You can handle the click event in the aspx page. What you need to do is to create a event handles and handle in aspx page.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Hi,
I have a link button in left frame,when i clicked on that button,a new page loaded on the second frame,but the linkbutton does not have target attribute,how the probelm will solve?
Thanks&Regards
Dilip
Hai this is fresh programer
|
|
|
|
|
Hi,
I have a project in which the operations are categorized based on the roles. The roles are DataEntryOperator,Moderator,Admin,Client.These roles are stored in database. A login screen is provided. The pages are created in 4 different folders in the project.Now if a peroson tries to access a page outside his/her folder he should be immediately redirected to the login page. How do I do this? I tried but couldn't
With Regards,
Uma
|
|
|
|
|
You can check the role of the user in the page load event of the page and can do the operations as per the requirement.
Best Regards,
Apurva Kaushal
|
|
|
|