Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Wed, 2 Jul 2008 08:31:12 -0700 (PDT),    group: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       


Urgent... Datagrid problem   
Thanks in advance...I have what seems like it should be a simple thing
for a DataGrid. What I'll be using this for is for a user to choose an
employee record on the datagrid then hit the detail button or link and
launch a new window showing the details for that specific employee. So
my query string needs to pickup the employee's ID and take it to a
details window.Unfortunately I'm using 1.1 and the number of fields I
may need to display is about 40. So I may need to do a repeater
control on the detail form (?) so I can control all the html
positioning. Any clues on a 1.1 idea for that? Thanks!
________________________

Here's what I tried first, a datagrid with a LinkButton that I can't
get to work. My initial problem is the error:

 BC30456: 'ViewDetails' is not a member of 'ASP.MainDepartment_aspx'.


Below is my html and my Code behind at the bottom:

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="MainDepartment.aspx.vb"
Inherits="Forsyth.HR_ReportingTool.UI.MainDepartment" %>
<FORM id="Form1" method="post" runat="server">
<asp:datagrid id="dgEmployees" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID="ViewDetails" CommandArgument='<%# Eval("id") %>'
Runat="server" OnCommand="ViewDetails">Details</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid></FORM>
</BODY>
</HTML>

Protected Sub ViewDetails(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.CommandEventArgs)
Response.Redirect("Details.aspx?id=" & e.CommandArgument.ToString())
End Sub

________________________

I've also tried using the below <asp:hyperlink> technique... with
errors on the

<asp:TemplateColumn>
    <ItemTemplate>
 <asp:HyperLink ID="ViewDetails" Runat="server" NavigateUrl='<%#
Eval("id","Details.aspx?id={0}") %>'>Details</asp:HyperLink>
    </ItemTemplate>
</asp:TemplateColumn>

________________________

Would Javascript be easier for all this?


I am using .net framework 1.1
date: Wed, 2 Jul 2008 08:31:12 -0700 (PDT)   author:   Brock

RE: Urgent... Datagrid problem   
"Brock" wrote:

> Thanks in advance...I have what seems like it should be a simple thing
> for a DataGrid. What I'll be using this for is for a user to choose an
> employee record on the datagrid then hit the detail button or link and
> launch a new window showing the details for that specific employee. So
> my query string needs to pickup the employee's ID and take it to a
> details window.Unfortunately I'm using 1.1 and the number of fields I
> may need to display is about 40. So I may need to do a repeater
> control on the detail form (?) so I can control all the html
> positioning. Any clues on a 1.1 idea for that? Thanks!
> ________________________
> 
> Here's what I tried first, a datagrid with a LinkButton that I can't
> get to work. My initial problem is the error:
> 
>  BC30456: 'ViewDetails' is not a member of 'ASP.MainDepartment_aspx'.
> 
> 
> Below is my html and my Code behind at the bottom:
> 
> <%@ Page Language="vb" AutoEventWireup="false"
> Codebehind="MainDepartment.aspx.vb"
> Inherits="Forsyth.HR_ReportingTool.UI.MainDepartment" %>
> <FORM id="Form1" method="post" runat="server">
> <asp:datagrid id="dgEmployees" >
> <Columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:LinkButton ID="ViewDetails" CommandArgument='<%# Eval("id") %>'
> Runat="server" OnCommand="ViewDetails">Details</asp:LinkButton>
> </ItemTemplate>
> </asp:TemplateColumn>
> </Columns>
> </asp:datagrid></FORM>
> </BODY>
> </HTML>
> 
> Protected Sub ViewDetails(ByVal source As Object, ByVal e As
> System.Web.UI.WebControls.CommandEventArgs)
> Response.Redirect("Details.aspx?id=" & e.CommandArgument.ToString())
> End Sub
> 
> ________________________
> 
> I've also tried using the below <asp:hyperlink> technique... with
> errors on the
> 
> <asp:TemplateColumn>
>     <ItemTemplate>
>  <asp:HyperLink ID="ViewDetails" Runat="server" NavigateUrl='<%#
> Eval("id","Details.aspx?id={0}") %>'>Details</asp:HyperLink>
>     </ItemTemplate>
> </asp:TemplateColumn>
> 
> ________________________
> 
> Would Javascript be easier for all this?
> 
> 
> I am using .net framework 1.1
> 

Please try the following code

<asp:DataGrid ID="dgEmployees" Runat="server" AutoGenerateColumns="False">
				<Columns>
					<asp:BoundColumn DataField="id" ReadOnly="True" 
Visible="True"></asp:BoundColumn>
					<asp:TemplateColumn>
						<ItemTemplate>
							<asp:LinkButton ID="ViewDetails" Runat="server" 
CommandName="ViewDetails">Details</asp:LinkButton>
						</ItemTemplate>
					</asp:TemplateColumn>
				</Columns>
			</asp:DataGrid>

private void dgEmployees_ItemCommand(object source, 
System.Web.UI.WebControls.DataGridCommandEventArgs e)
		{
			if(e.CommandName=="ViewDetails")
			{
				Response.Redirect("Details.aspx?id="+e.Item.Cells[0].Text);
			}
		}

Please Try this code.It will work

Cheers,
Rajagopal.T
date: Tue, 22 Jul 2008 23:57:00 -0700   author:   Rajagopal

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us