473,812 Members | 3,417 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGrid Problem

44 New Member
Hello Friends

I have designed the form with three dropdownlist boxes named Default.aspx. The first DropDownList box (DropDownList1) is filled with movie names. The second DropDownList box(DropDownLis t2)is filled with theatre names and the third DropDownList box (DropDownList3) is filled with dates from sql server. In my Second form(Default2.a spx) ,I have called these dropdown boxes selected value from Default.aspx form using query and populated the GridView1 in the form Default2.aspx. Also I have placed the Panel Control(Panel1) in this Default2.aspx form .Each data in the GridView has made as a link button by using the codings

HTML Codings:

<asp:GridView ID="GridView1" runat="server" Style="z-index: 101; left: 355px; position: absolute;
top: 27px" CellPadding="4" ForeColor="#333 333" GridLines="None " AutoGenerateCol umns="False" OnSelectedIndex Changed="GridVi ew1_SelectedInd exChanged">

<Columns>
<asp:TemplateFi eld>
<ItemTemplate >
<div>
<asp:LinkButt on ID="Link1" Text='<%#Bind(" Link1") %>' PostBackUrl='<% #Bind("Link1") %>' OnClientClick=" " runat="Server"> Link1</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld>
<ItemTemplate >
<div>
<asp:LinkButt on ID="Link2" Text='<%#Bind(" Link2") %>' PostBackUrl='<% #Bind("Link2") %>' runat="Server"> Link2</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld>
<ItemTemplate >
<div>
<asp:LinkButt on ID="Link3" Text='<%#Bind(" Link3") %>' PostBackUrl='<% #Bind("Link3") %>' runat="Server"> Link3</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateFie ld>
<asp:TemplateFi eld>
<ItemTemplate >
<div>
<asp:LinkButt on ID="Link4" Text='<%#Bind(" Link4") %>' PostBackUrl='<% #Bind("Link4") %>' runat="Server"> Link4</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>

<FooterStyle BackColor="#5D7 B9D" Font-Bold="True" ForeColor="Whit e" />
<RowStyle BackColor="#F7F 6F3" ForeColor="#333 333" />
<EditRowStyle BackColor="#999 999" />
<SelectedRowSty le BackColor="#E2D ED6" Font-Bold="True" ForeColor="#333 333" />
<PagerStyle BackColor="#284 775" ForeColor="Whit e" HorizontalAlign ="Center" />
<HeaderStyle BackColor="#5D7 B9D" Font-Bold="True" ForeColor="Whit e" />
<AlternatingRow Style BackColor="Whit e" ForeColor="#284 775" />

</asp:GridView>

In my code behind,

I have given the coding as

protected void Page_Load(objec t sender, EventArgs e)
{
object obj;
obj = (object)Session["movie"];

object obj1;
obj1 =(object)Sessio n["theatre"];

object obj2;
obj2 = (object)Session["date"];
SqlConnection con = new SqlConnection(" user id=sa;password= cast;database=T HEATRE;server=A URORA-SERVER;");
con.Open();
string dgstr = "select s.showtime from ShowDetails s,TheatreMaster t, MovieMaster m where t.tname= '" + obj1.ToString() + "' and m.moviename='" + obj.ToString() + "' and s.date='" + obj2.ToString() + "'";
SqlCommand dgcmd=new SqlCommand(dgst r,con);
string dgstr2 = "select count(showtime) from ShowDetails";
SqlCommand dgcmd1=new SqlCommand(dgst r2,con);
SqlDataReader DRCount = dgcmd1.ExecuteR eader();
DataTable dt = new DataTable();
dt.Columns.Add( new DataColumn("Lin k1", typeof(string)) );
dt.Columns.Add( new DataColumn("Lin k2", typeof(string)) );
dt.Columns.Add( new DataColumn("Lin k3", typeof(string)) );
dt.Columns.Add( new DataColumn("Lin k4", typeof(string)) );

if (DRCount.Read() )
{
int noOfRows;
if ((int)DRCount[0] % 4 == 0)
{
noOfRows = (int)DRCount[0] % 4;
}
else
noOfRows = ((int)DRCount[0] % 4) + 1;
DRCount.Close() ;
SqlDataReader DR1 = dgcmd.ExecuteRe ader();
for (int i = 0; i <=noOfRows; i++)
{
DataRow dr = dt.NewRow();
if (DR1.Read())
{
dr["Link1"] = DR1[0];

}
//dr = dt.NewRow();
if (DR1.Read())
{
dr["Link2"] = DR1[0];

}

//dr = dt.NewRow();
if (DR1.Read())
{
dr["Link3"] = DR1[0];
}

if (DR1.Read())
{
dr["Link4"] = DR1[0];
}
dt.Rows.Add(dr) ;
}
}
GridView1.DataS ource = dt;
GridView1.DataB ind();
}

Here the obj,obj1,obj2 are the values of the DropDownList boxes(Movie, Theatre & Date) in the Previous Form.

Now the thing is, if I click any data(link button) inside the datagrid, then the Panel Control(Panel1) which is on the outside of the Gridiew should get visible.

For that I have given the Script codings as

<script type="text/javascript" language="javas cript">
function AddToList()
{
var drop = document.getEle mentById('<%=_P anel1.ClientID. visibility.visi ble="True"%>');
</script>

But it is showing the error as

Error 1 The name '_Panel1' does not exist in the current context C:\Documents and Settings\user\M y Documents\Visua l Studio 2005\WebSites\A JAXEnabledWebSi te5\Default2.as px 11

So the Panel1 is not getting visible.


-sweatha
Apr 26 '08 #1
0 989

Sign in to post your reply or Sign up for a free account.

Similar topics

2
9931
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell (multi-select without modifier keys). I got that working fine, but I also wanted to keep rows selected after a sort, which I do by storing the row's id in an arraylist. The idea was to do the sort and then go back and re-select the rows with that...
0
3192
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some text. Before changing to another cell in the DataGrid, I move my mouse pointer off the DataGrid and change the selected item in a ListBox or TreeView. Here's my question Which should fire first, the DataTable's RowChanged/CellChanged event or...
5
2601
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order date, name, address etc) about the selected row in the datagrid... My problem is when I enter a new record in the details tabpage (saves data to database), and go back to the datagrid. Only the data from the PM-table
1
4347
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
4
2129
by: The Alchemist | last post by:
I am having a problem with a dynamically-generated Datagrid. It is important to point out that this problem does not exist with a design-time created Datagrid, but only with a dynamically generated Datagrid in a Web Custom Control (WCC) : The datagrid has LinkButton Column which has a select LinkButton for each row. When this button is clicked, the Datagrid raises its 'ItemCommand' event which captures the information for that row and...
9
5068
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ******************************************************************************* <asp:DataGrid visible="False" border=1
4
3500
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a snippet from my .css file: *************************** body { margin:0; padding:0;
0
1707
by: optimizeit | last post by:
What I am attempting to do is import an Excel Workbook and display the worksheets in a datagrid dynamically. I am very close to getting this to work. I have to this point successfully imported a single worksheet into a dataset. I successfully built a dynamic datagrid. And I did successfully bind it to the dataset. Then I added the datagrid control to a PlaceHolder. The first worksheet displays beautifully. The next step is to allow...
9
2734
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the code: <script runat="server"> Dim sqlConn As New SqlConnection(".....") Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) If Not (Page.IsPostBack) Then FillDataGrid()
2
6600
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
9734
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
10404
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
10417
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
10139
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
9220
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
7678
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
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4357
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.