 |
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

February 6th, 2011, 11:16 AM
|
Authorized User
|
|
Join Date: Feb 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Grid View Problem
Hi,
This is Ranveer I am designing a website for job consultancy . My requirement as follows I would like to create a page for manager of website who can put vacancy on website and he can update delete the vacancy as per his requirement.
When Manager of website login this page should open and through this page he can insert new vacancy, he can delete the existing vacancy and he can update the vacancy.
And when other user login he can only see the vacancy posted by the Manager. He should not have update , delete and insert facility.
Pls help me
Regards
Ranveer Kumar
|

February 6th, 2011, 11:22 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
That's quite a broad question. Is there anything in particular you need help with?
Also, take a look at the Data section of the getting started guide at the asp.net web site: http://www.asp.net/web-forms
Additionally, you may want to get a copy of my book Beginning ASP.NET 4 (or 3.5) in C# and VB which discuss stuff like this in detail. See my signature for links.
Cheers,
Imar
|

February 18th, 2011, 10:31 AM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Hi,
I also have a gridview issue but I didnt want to start a thread. The soution displays the first page but when I click next page I get a blank 2nd page even though there are more than 50 records returned.
The code is as follows.
Code:
<asp:GridView ID="GridView1" runat="server" AllowPaging="true"
OnPageIndexChanging="gridView_PageIndexChanging" >
<Columns>
<asp:TemplateField HeaderText="Session">
<ItemTemplate>
<asp:CheckBox ID="myCheckbox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Code behind is as follows
Code:
Protected Sub gridView_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs)
Me.GridView1.PageIndex = e.NewPageIndex
Me.GridView1.DataBind()
End Sub
can anyone help. I'm sure the code is ok. Is there anyting else I need to do?
Last edited by GeeTee991100; February 18th, 2011 at 11:01 AM..
|

February 18th, 2011, 11:40 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Quote:
I also have a gridview issue but I didnt want to start a thread.
|
Why not? New threads make things easier to manage for everybody. New topic = new thread.
That said, why are you manually implementing paging if you already set AllowPaging to true? Depending on your requirements, you shouldn't have to handle PageIndexChanging.
Cheers,
Imar
|

February 18th, 2011, 12:07 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Hi,
Thanks for the response.
I use manual paging because the record set is produced in my code behind. I have to pull data back from a number of tables with each query dependent on the user selection. ie I want to display all students that are enrolled on course for a project etc. Where the project number and the course are input via three drop down lists thus I didnt think I could achieve this in mark up. Is it possible in mark up?
This is all my mark upcode
Code:
<%@ Page Title="Edit Register" Language="VB" MasterPageFile="~/MasterPages/MasterPage.master"
AutoEventWireup="false" CodeFile="EditRegister.aspx.vb" Inherits="SessionsRegisters_Registers_EditRegister" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
width: 127px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<table class="style1">
<tr>
<td class="style2">
Project No</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="LinqDataSource1" DataTextField="ProjectNo"
DataValueField="ProjectNo" Height="25px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style2">
Project Ref</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" AutoPostBack="True">
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="style2">
Date of Activity</td>
<td>
<asp:DropDownList ID="DropDownList3" runat="server" AutoPostBack="True">
</asp:DropDownList>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="Button1" runat="server" Text="Update Register" Visible="false" />
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="DataClassesDataContext"
OrderBy="ProjectNo" Select="new (ProjectNo)" TableName="Projects">
</asp:LinqDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="true"
OnPageIndexChanging="gridView_PageIndexChanging" >
<Columns>
<asp:TemplateField HeaderText="Session">
<ItemTemplate>
<asp:CheckBox ID="myCheckbox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:Content>
|

February 18th, 2011, 01:08 PM
|
Authorized User
|
|
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
|
|
Hi,
Do you need any more information?
Iwant the user to select the project from a drop down list then depending on which project selected populate the 2nd drop down list with all the relevant project references for the project then use that to populate a 3rd drop down list which will be all the dates that there was an activity for that project and that reference. This is why I build the gridview datasource in code behind and have to use manual paging on my gridview. Can I achieve that type of look up using asp mark up? Why does it only display one page? Can anyone help me ?
Thanx
Last edited by GeeTee991100; February 18th, 2011 at 01:10 PM..
|

February 18th, 2011, 02:00 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I think what you're missing is a reassignment of the data source. E.g. instead of:
Code:
Me.GridView1.PageIndex = e.NewPageIndex
Me.GridView1.DataBind()
You need something like
Code:
Me.GridView1.PageIndex = e.NewPageIndex
Me.GridView1.DataSource = GetDataSource()
Me.GridView1.DataBind()
where GetDataSource() represents the code needed to get the data. You probably have that in your Page_Load right now.
Cheers,
Imar
|
Similar Threads
|
Thread |
Thread Starter |
Forum |
Replies |
Last Post |
Grid View problem help please |
Shimul Mahmud |
ASP.NET 3.5 Professionals |
0 |
March 8th, 2010 03:51 AM |
Grid view |
roopeshmkatlive.in |
ASP.NET 1.0 and 1.1 Professional |
1 |
August 1st, 2008 01:03 PM |
Help Grid View Drop Down List, view all |
jskinner123 |
ASP.NET 2.0 Basics |
0 |
November 25th, 2007 06:25 PM |
grid view |
MunishBhatia |
ASP.NET 2.0 Professional |
2 |
June 5th, 2007 12:15 AM |
grid view |
MunishBhatia |
ASP.NET 2.0 Professional |
1 |
May 25th, 2007 07:26 AM |
|
 |