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