Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 6th, 2011, 11:16 AM
Authorized User
Points: 86, Level: 1
Points: 86, Level: 1 Points: 86, Level: 1 Points: 86, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2011
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Default 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
  #2 (permalink)  
Old February 6th, 2011, 11:22 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #3 (permalink)  
Old February 18th, 2011, 10:31 AM
Authorized User
Points: 149, Level: 2
Points: 149, Level: 2 Points: 149, Level: 2 Points: 149, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default

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..
  #4 (permalink)  
Old February 18th, 2011, 11:40 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
  #5 (permalink)  
Old February 18th, 2011, 12:07 PM
Authorized User
Points: 149, Level: 2
Points: 149, Level: 2 Points: 149, Level: 2 Points: 149, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default

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>
  #6 (permalink)  
Old February 18th, 2011, 01:08 PM
Authorized User
Points: 149, Level: 2
Points: 149, Level: 2 Points: 149, Level: 2 Points: 149, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2010
Posts: 38
Thanks: 8
Thanked 0 Times in 0 Posts
Default

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..
  #7 (permalink)  
Old February 18th, 2011, 02:00 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.