HI 코더 데이터가 데이터베이스에서 오는 gridview가 있습니다. 이제 모든 행의 ID가 동일합니다. 그리드 뷰의 첫 번째 행만 표시하고 나머지는 숨기고 싶습니다. 그러나 그들의 가치가 아니라 나는 그들을 그냥 숨 깁니다. 나는 라이트 박스를 가지고 있기 때문에 그들의 가치를 원한다. 무작위로 생성 된 gridview 행을 숨기는 방법
이
내 코드입니다 : 이<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>
편집 :
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();
}
}
위의 코드 pptId의 각 행에 대해 동일합니다, 내 이미지는 내가 원하는 것은 단지 보여주기 위해 내 gridview에 내부 보여 첫 번째 이미지는 나머지 값은 숨기지 만 그 값은 숨 깁니다.
어떻게해야합니까? ..... 미리 감사드립니다.
그래서 다른 행을 삭제하지 않고 첫 번째 행을 표시하고 싶습니까? – Plue
그래, 나는 그들을 삭제하고 싶지 않다. 나는 단지 그들을 숨기고 싶다. pptId는 각 줄마다 같지만 imageurl과 priority는 다르다.당신이 말할 수있는 것처럼 1 ppt 다른 우선 순위와 5 개의 이미지를 가지고 그래서 첫 번째 ppt의 이미지를 보여주고 있지만 gridview에서 나는 오직 첫 번째와 그들 중 나머지를 숨겨 그래서 나는 그것에 대한 나의 라이트 박스가 작동하도록 그 값을 가지고있다 – Amitesh
잘 모르겠다. 그것을 얻으십시오 ... 왜 priotity와 imageurl가 다른 경우에 전체 줄을 숨기고 있습니까? 각 행에 대해 첫 번째 셀을 숨기지 않겠습니까? – Plue