473,809 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_ItemComman d (Object sender,
DataGridCommand EventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells
[0].Text;
Response.Redire ct (
targetPage, true );
}
}

Thanks,

Dave
Nov 15 '05 #1
4 1782
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.Ra wUrl ) we can see where is the problem.

Cheers,

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

"Dave bailey" <an*******@disc ussions.microso ft.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_ItemComman d (Object sender,
DataGridCommand EventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells
[0].Text;
Response.Redire ct (
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.Ra wUrl ) we can see where is the problem.
Cheers,

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

"Dave bailey" <an*******@disc ussions.microso ft.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_ItemComman d (Object sender,
DataGridCommand EventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells
[0].Text;
Response.Redire ct (
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*******@disc ussions.microso ft.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.Ra wUrl ) we can see where is the

problem.

Cheers,

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

"Dave bailey" <an*******@disc ussions.microso ft.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_ItemComman d (Object sender,
DataGridCommand EventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells
[0].Text;
Response.Redire ct (
targetPage, true );
}
}

Thanks,

Dave

.

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

Thanks,

dave

using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;
using System.Configur ation;
using System.Data.Ole Db;

namespace Type3CTracking
{
/// <summary>
/// Summary description for MRDetailsForm.
/// </summary>
public class MRDetailsForm : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Labe l
mrLabel;
protected System.Web.UI.W ebControls.Pane l
Panel1;
protected
System.Web.UI.W ebControls.Text Box mrText;
protected DataGrid workorderGrid = new
DataGrid();
protected System.Web.UI.W ebControls.Labe l
workorderLabel;
protected
System.Web.UI.W ebControls.Plac eHolder workorderHolder ;
protected
System.Data.Ole Db.OleDbDataAda pter oda;

private void Page_Load(objec t sender,
System.EventArg s e)
{
string mr = Request["MR"];
mrText.Text = mr;

if (!IsPostBack)
{

workorderHolder .Controls.Add(M akeWorkorderGri d());
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required
by the ASP.NET Web Form Designer.
//
InitializeCompo nent();
base.OnInit(e);
}

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

}
#endregion

public DataView CreateWorkorder DataSource()
{
string workorderConnec t
= "Provider=\"MSD AORA.1\";User ID=dave;Data
Source=demo;Pas sword=xxxxxxxx" ;
string workorderSelect = "Select
MR.Mrnum, Mrline.Mrlinenu m, Workorder.Wonum ,
Workorder.Descr iption from" +
" MR, Mrline, Workorder
where MR.Mrnum = Mrline.Mrnum and Mrline.Wonum =
Workorder.Wonum " +
" and MR.Mrnum = " + "'" +
mrText.Text + "'";

oda = new OleDbDataAdapte r
(workorderSelec t, workorderConnec t);
DataSet ds = new DataSet();

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

public DataGrid MakeWorkorderGr id()
{
//make the DataGrid

workorderGrid.C ellPadding = 2;
workorderGrid.C ellSpacing = 0;
workorderGrid.W idth = 700;
workorderGrid.B orderWidth = 1;
workorderGrid.B orderColor =
Color.Black;

//turn off autogeneratecol umns
feature
workorderGrid.A utoGenerateColu mns
= false;
workorderGrid.F oreColor =
Color.Blue;
workorderGrid.F ont.Size = 10;
workorderGrid.F ont.Name = "Arial";

//sets the HeaderStyle

workorderGrid.H eaderStyle.Back Color = Color.Gold;

workorderGrid.H eaderStyle.Fore Color = Color.Blue;

workorderGrid.H eaderStyle.Font .Name = "Arial";

workorderGrid.H eaderStyle.Font .Size = 10;

workorderGrid.H eaderStyle.Font .Bold = true;

workorderGrid.H eaderStyle.Hori zontalAlign =
HorizontalAlign .Center;

//sets alternating style

workorderGrid.A lternatingItemS tyle.BackColor =
Color.Silver;

workorderGrid.A lternatingItemS tyle.ForeColor =
Color.Black;

//sets the itemstyle

workorderGrid.I temStyle.Horizo ntalAlign =
HorizontalAlign .Center;

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

Mrlinenum.Heade rText = "MR Line
Number";
Mrlinenum.DataF ield = "Mrlinenum" ;

Desc.HeaderText = "Descriptio n";
Desc.DataField = "Descriptio n";

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

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

//bind the DataDrid
workorderGrid.D ataSource =
CreateWorkorder DataSource();
workorderGrid.D ataBind();
return workorderGrid;
}
public void Grid_ItemComman d (Object
sender, DataGridCommand EventArgs e)
{
if ( e.CommandName == "Details" )
{
string targetPage
= "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells
[0].Text;
Response.Redire ct(
targetPage, true );
}
}

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

That will be a good idea

Cheers,

--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation
"Dave Bailey" <an*******@disc ussions.microso ft.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.Ra wUrl ) we can see where is the

problem.
>
>Cheers,
>
>--
>Ignacio Machin,
>ignacio.mach in AT dot.state.fl.us
>Florida Department Of Transportation
>
>"Dave bailey" <an*******@disc ussions.microso ft.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_ItemComman d (Object sender,
>> DataGridCommand EventArgs e)
>> {
>> if ( e.CommandName == "Details" )
>> {
>> string targetPage
>> = "workorderDetai lsForm.aspx?Wor korder=" + e.Item.Cells >> [0].Text;
>> Response.Redire ct (
>> 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
1290
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) disappears. My code to perform the datagrid sort is below. My datagrid's AllowSorting property is TRUE. Could someone please let me know how I can fix this code so that the datagrid sorts correctly? Thanks. Private Sub DataGrid1_SortCommand(ByVal...
0
1032
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 Code Follows:
3
1659
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 that is not on the first page, the web-page displays the first page of the datagrid again and show the details of the field on the same location, but on the first page. For instance, if I have the first page with the following data:
8
3053
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 client-side coding needed for the user to click a "select" button (HTMLButton) in column 0 of the datagrid and have the table objects auto-fill with corresponding values from the dataset row in the datagrid without making a roundtrip to the server. ...
8
2029
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 the bound DataGrid does not pick up and appends the inserted row at the bottom of the grid, not the right position?!? Any ideas how to make the DataGrid pick up the changes done in the table - to show the inserted row at the right position?
2
1646
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 ColStyle as New DataGridTextBoxColomn ColStyle.TextBox.Contains(ProgressBar1) didn't show anything inside.
0
1353
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 Parent (this refelect GUI'wise a Parent Child related data). I also add Handlers to the sub datagrid using AddHandler to handle the EditCommandColumn as well as ItemDataBound. Parent Datagrid...
0
1938
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 ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean Const WM_KEYDOWN As Integer = &H100
2
1407
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 after the edit is complete, the hyperlink text re-appears and the link is active. How do I keep the hyperlink text (link does not need to be active) displayed on the edit row? Thanks for your help.
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10643
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10378
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.