473,395 Members | 1,730 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DataGrid disappears

When I execute the following code when using a dynamicall
created LinkButton in a dynamically created dataGrid, the
DataGrid disappears and the page I am trying to get to
does not load. Can anyone see what is wrong here?

protected void Grid_ItemCommand (Object sender,
DataGridCommandEventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells
[0].Text;
Response.Redirect (
targetPage, true );
}
}

Thanks,

Dave
Nov 15 '05 #1
4 1766
Hi Dave,

Well that code should works fine, what show the address bar of the browser?
does it stay in the same page?
Maybe if you post an example with the result of targetPage and the current
request ( Page.Request.RawUrl ) we can see where is the problem.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dave bailey" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
When I execute the following code when using a dynamicall
created LinkButton in a dynamically created dataGrid, the
DataGrid disappears and the page I am trying to get to
does not load. Can anyone see what is wrong here?

protected void Grid_ItemCommand (Object sender,
DataGridCommandEventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells
[0].Text;
Response.Redirect (
targetPage, true );
}
}

Thanks,

Dave

Nov 15 '05 #2
When I click on the LinkButton the DataGrid disappears and
the page does not move. It is the same page with the
DataGrid gone. Any thoughts? I can send all teh code on
Monday when I get back to work if that helps.

Thanks,

Dave

-----Original Message-----
Hi Dave,

Well that code should works fine, what show the address bar of the browser?does it stay in the same page?
Maybe if you post an example with the result of targetPage and the currentrequest ( Page.Request.RawUrl ) we can see where is the problem.
Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dave bailey" <an*******@discussions.microsoft.com> wrote in messagenews:09****************************@phx.gbl...
When I execute the following code when using a dynamicall created LinkButton in a dynamically created dataGrid, the DataGrid disappears and the page I am trying to get to
does not load. Can anyone see what is wrong here?

protected void Grid_ItemCommand (Object sender,
DataGridCommandEventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells
[0].Text;
Response.Redirect (
targetPage, true );
}
}

Thanks,

Dave

.

Nov 15 '05 #3
HI Dave,

That will be a good idea

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Dave Bailey" <an*******@discussions.microsoft.com> wrote in message
news:02****************************@phx.gbl...
When I click on the LinkButton the DataGrid disappears and
the page does not move. It is the same page with the
DataGrid gone. Any thoughts? I can send all teh code on
Monday when I get back to work if that helps.

Thanks,

Dave

-----Original Message-----
Hi Dave,

Well that code should works fine, what show the address

bar of the browser?
does it stay in the same page?
Maybe if you post an example with the result of

targetPage and the current
request ( Page.Request.RawUrl ) we can see where is the

problem.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Dave bailey" <an*******@discussions.microsoft.com> wrote

in message
news:09****************************@phx.gbl...
When I execute the following code when using a dynamicall created LinkButton in a dynamically created dataGrid, the DataGrid disappears and the page I am trying to get to
does not load. Can anyone see what is wrong here?

protected void Grid_ItemCommand (Object sender,
DataGridCommandEventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells
[0].Text;
Response.Redirect (
targetPage, true );
}
}

Thanks,

Dave

.

Nov 15 '05 #4
Here is the whole code. I hope this helps.

Thanks,

dave

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Configuration;
using System.Data.OleDb;

namespace Type3CTracking
{
/// <summary>
/// Summary description for MRDetailsForm.
/// </summary>
public class MRDetailsForm : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label
mrLabel;
protected System.Web.UI.WebControls.Panel
Panel1;
protected
System.Web.UI.WebControls.TextBox mrText;
protected DataGrid workorderGrid = new
DataGrid();
protected System.Web.UI.WebControls.Label
workorderLabel;
protected
System.Web.UI.WebControls.PlaceHolder workorderHolder;
protected
System.Data.OleDb.OleDbDataAdapter oda;

private void Page_Load(object sender,
System.EventArgs e)
{
string mr = Request["MR"];
mrText.Text = mr;

if (!IsPostBack)
{

workorderHolder.Controls.Add(MakeWorkorderGrid());
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required
by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support -
do not modify
/// the contents of this method with the
code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new
System.EventHandler(this.Page_Load);

}
#endregion

public DataView CreateWorkorderDataSource()
{
string workorderConnect
= "Provider=\"MSDAORA.1\";User ID=dave;Data
Source=demo;Password=xxxxxxxx";
string workorderSelect = "Select
MR.Mrnum, Mrline.Mrlinenum, Workorder.Wonum,
Workorder.Description from" +
" MR, Mrline, Workorder
where MR.Mrnum = Mrline.Mrnum and Mrline.Wonum =
Workorder.Wonum" +
" and MR.Mrnum = " + "'" +
mrText.Text + "'";

oda = new OleDbDataAdapter
(workorderSelect, workorderConnect);
DataSet ds = new DataSet();

oda.Fill(ds, "workorder");
DataView workorder = ds.Tables
["workorder"].DefaultView;
return workorder;
}

public DataGrid MakeWorkorderGrid()
{
//make the DataGrid

workorderGrid.CellPadding = 2;
workorderGrid.CellSpacing = 0;
workorderGrid.Width = 700;
workorderGrid.BorderWidth = 1;
workorderGrid.BorderColor =
Color.Black;

//turn off autogeneratecolumns
feature
workorderGrid.AutoGenerateColumns
= false;
workorderGrid.ForeColor =
Color.Blue;
workorderGrid.Font.Size = 10;
workorderGrid.Font.Name = "Arial";

//sets the HeaderStyle

workorderGrid.HeaderStyle.BackColor = Color.Gold;

workorderGrid.HeaderStyle.ForeColor = Color.Blue;

workorderGrid.HeaderStyle.Font.Name = "Arial";

workorderGrid.HeaderStyle.Font.Size = 10;

workorderGrid.HeaderStyle.Font.Bold = true;

workorderGrid.HeaderStyle.HorizontalAlign =
HorizontalAlign.Center;

//sets alternating style

workorderGrid.AlternatingItemStyle.BackColor =
Color.Silver;

workorderGrid.AlternatingItemStyle.ForeColor =
Color.Black;

//sets the itemstyle

workorderGrid.ItemStyle.HorizontalAlign =
HorizontalAlign.Center;

//create the bound columns
BoundColumn Wonum = new BoundColumn
();
BoundColumn Mrlinenum = new
BoundColumn();
BoundColumn Desc = new BoundColumn
();
Wonum.HeaderText = "Wonum";
Wonum.DataField = "Wonum";

Mrlinenum.HeaderText = "MR Line
Number";
Mrlinenum.DataField = "Mrlinenum";

Desc.HeaderText = "Description";
Desc.DataField = "Description";

//add bound columns to datagrid
workorderGrid.Columns.AddAt(0,
Wonum);
workorderGrid.Columns
[0].ItemStyle.Width = 20;
workorderGrid.Columns.AddAt(1,
Mrlinenum);
workorderGrid.Columns
[1].ItemStyle.Width = 100;
workorderGrid.Columns.AddAt(2,
Desc);

//add a LinkButton column
ButtonColumn bc = new ButtonColumn
();
bc.ButtonType =
ButtonColumnType.LinkButton;
bc.Text = "Click to View workorder
details";
bc.CommandName = "Details";
workorderGrid.Columns.Add(bc);
workorderGrid.Columns
[3].HeaderText = "View Details";

//bind the DataDrid
workorderGrid.DataSource =
CreateWorkorderDataSource();
workorderGrid.DataBind();
return workorderGrid;
}
public void Grid_ItemCommand (Object
sender, DataGridCommandEventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells
[0].Text;
Response.Redirect(
targetPage, true );
}
}

}
}
-----Original Message-----
HI Dave,

That will be a good idea

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Dave Bailey" <an*******@discussions.microsoft.com> wrote in messagenews:02****************************@phx.gbl...
When I click on the LinkButton the DataGrid disappears and the page does not move. It is the same page with the
DataGrid gone. Any thoughts? I can send all teh code on Monday when I get back to work if that helps.

Thanks,

Dave

>-----Original Message-----
>Hi Dave,
>
>Well that code should works fine, what show the address

bar of the browser?
>does it stay in the same page?
>Maybe if you post an example with the result of

targetPage and the current
>request ( Page.Request.RawUrl ) we can see where is the

problem.
>
>Cheers,
>
>--
>Ignacio Machin,
>ignacio.machin AT dot.state.fl.us
>Florida Department Of Transportation
>
>"Dave bailey" <an*******@discussions.microsoft.com> wrote
in message
>news:09****************************@phx.gbl...
>> When I execute the following code when using a

dynamicall
>> created LinkButton in a dynamically created dataGrid,

the
>> DataGrid disappears and the page I am trying to get

to >> does not load. Can anyone see what is wrong here?
>>
>> protected void Grid_ItemCommand (Object sender,
>> DataGridCommandEventArgs e)
>> {
>> if ( e.CommandName == "Details" )
>> {
>> string targetPage
>> = "workorderDetailsForm.aspx?Workorder=" + e.Item.Cells >> [0].Text;
>> Response.Redirect (
>> targetPage, true );
>> }
>> }
>>
>> Thanks,
>>
>> Dave
>
>
>.
>

.

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MrMike | last post by:
Hi. I have a webform datagrid which should sort whenever the column is clicked. However, when the column is clicked no sorting occurs and the datagrid (with the exception of the header)...
0
by: Dave Bailey | last post by:
I am posting the entire code for this problem in hopes soneone can see what is wrong and why the page refreshes and the dataGrid disappears but the new page does not load. Thanks, Dave ...
3
by: Ruy Castelli | last post by:
Hello, I'm trying to get the details out of a datagrid component and it works fine when I'm accessing the first page of the datagrid, but when I try to click on the details hyperlink for an item...
8
by: Sue | last post by:
I have a datagrid populated with 6 visible read-only labels and several hidden fields. Below the datagrid, I have a table with various textboxes, dropdowns, etc. I've managed to decypher the...
8
by: Strahimir Antoljak | last post by:
I bound a DataGrid to a table (I tried with a DataView too). I removed the row from the table, and then inserted a new row at the same row index. the table gets the row to the right position, but...
2
by: Bunnist-Priest | last post by:
Hello Everyone, My first predicament is that I want to make a colomn of my vb.net DataGrid a ProgressBar colomn. (full of Pr.Bars). Is it that difficult? Is there a code example? using - Dim...
0
by: news.zen.co.uk | last post by:
Hi Guys, Using VB .NET 2003 and ASP1.1, I have a Datagrid embedded in an ASP page. In the processing of the ItemDataBound event I dynamically create a new Datagrid control within the Cell of the...
0
by: Matt | last post by:
I derived my own custom class from the datagrid class. I overrode the ProcessCmdKey Function, like this, to catch the up and down arrow keys: ====== Protected Overrides Function...
2
by: rpdavis | last post by:
I have a datagrid that includes editable colums as well as a hyperlink. When the user selects to edit a row in the datagrid, the text for the hyperlink disappears. When the grid is refreshed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.