HI coder i have a gridview in which data comes from database.. now id of all row is same what i want it to show only first row of my gridview and hide rest of the others but not their value i just wana hide them. i want their value because i have a lightbox on it.
this is my code:
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"
AutoGenerateColumns="False" PageSize="1" PersistedSelection="true"
DatakeyNames="pptId,Priority">
<Columns>
<asp:TemplateField HeaderText="pptId" Visible="false">
<ItemTemplate>
<asp:Label ID="lblpptId" runat="server" Text='<%# Bind("pptId") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Priority" Visible="false">
<ItemTemplate>
<asp:Label ID="lblPriority" runat="server" Text='<%# Bind("Priority") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View PPT">
<ItemTemplate>
<a id="imageLink" href='<%# Eval("Imageurl") %>' title='<%#Eval("Description") %>'
rel="lightbox[Brussels]" runat="server">Start PPT</a>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<AlternatingRowStyle BackColor="White" />
<EditRowStyle BackColor="#2461BF" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#EFF3FB" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F5F7FB" />
<SortedAscendingHeaderStyle BackColor="#6D95E1" />
<SortedDescendingCellStyle BackColor="#E9EBEF" />
<SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView>
EDIT::
protected void Page_Load(object sender, EventArgs e)
{
BindModule();
}
protected void BindModule()
{
try
{
con.Open();
string id = Request.QueryString["pptId"].ToString();
//Query to get Imagesurl and Description from database
SqlCommand command = new SqlCommand("select * from Image_Master where pptId='" + id + "' and IsEnable='True' order by Priority", con);
dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(command);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
GridView1.Dispose();
}
catch (Exception ex)
{
Response.Write("Error occured : " + ex.Message.ToString());
}
finally
{
con.Close();
}
}
in the above code pptId is same for each row, my images show inside my gridview what i want is to show only first images and hide rest of other but not their values..
how to i do that.....thanks in advance
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…