473,385 Members | 1,506 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,385 software developers and data experts.

DataGrid Problem

44
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(DropDownList2)is filled with theatre names and the third DropDownList box (DropDownList3) is filled with dates from sql server. In my Second form(Default2.aspx) ,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="#333333" GridLines="None" AutoGenerateColumns="False" OnSelectedIndexChanged="GridView1_SelectedIndexCha nged">

<Columns>
<asp:TemplateField>
<ItemTemplate>
<div>
<asp:LinkButton ID="Link1" Text='<%#Bind("Link1") %>' PostBackUrl='<%#Bind("Link1") %>' OnClientClick="" runat="Server">Link1</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<div>
<asp:LinkButton ID="Link2" Text='<%#Bind("Link2") %>' PostBackUrl='<%#Bind("Link2") %>' runat="Server">Link2</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<div>
<asp:LinkButton ID="Link3" Text='<%#Bind("Link3") %>' PostBackUrl='<%#Bind("Link3") %>' runat="Server">Link3</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<div>
<asp:LinkButton ID="Link4" Text='<%#Bind("Link4") %>' PostBackUrl='<%#Bind("Link4") %>' runat="Server">Link4</asp:LinkButton>
</div>
</ItemTemplate>
</asp:TemplateField>
</Columns>

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<EditRowStyle BackColor="#999999" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</asp:GridView>

In my code behind,

I have given the coding as

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

object obj1;
obj1 =(object)Session["theatre"];

object obj2;
obj2 = (object)Session["date"];
SqlConnection con = new SqlConnection("user id=sa;password=cast;database=THEATRE;server=AURORA-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(dgstr,con);
string dgstr2 = "select count(showtime) from ShowDetails";
SqlCommand dgcmd1=new SqlCommand(dgstr2,con);
SqlDataReader DRCount = dgcmd1.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("Link1", typeof(string)));
dt.Columns.Add(new DataColumn("Link2", typeof(string)));
dt.Columns.Add(new DataColumn("Link3", typeof(string)));
dt.Columns.Add(new DataColumn("Link4", 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.ExecuteReader();
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.DataSource = dt;
GridView1.DataBind();
}

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="javascript">
function AddToList()
{
var drop = document.getElementById('<%=_Panel1.ClientID.visib ility.visible="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\My Documents\Visual Studio 2005\WebSites\AJAXEnabledWebSite5\Default2.aspx 11

So the Panel1 is not getting visible.


-sweatha
Apr 26 '08 #1
0 970

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

Similar topics

2
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...
0
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...
5
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...
1
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...
4
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...
9
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: ...
4
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...
0
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...
9
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...
2
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.