Click here to Skip to main content
14,876,655 members
Home / Discussions / C#
   

C#

 
AnswerRe: Checking for existing open forms Pin
Richard Deeming25-Mar-21 2:51
mveRichard Deeming25-Mar-21 2:51 
QuestionCopy a selected gridview row to the same gridview Pin
Member 1493285423-Mar-21 2:41
MemberMember 1493285423-Mar-21 2:41 
AnswerRe: Copy a selected gridview row to the same gridview Pin
Gerry Schmitz23-Mar-21 7:08
mveGerry Schmitz23-Mar-21 7:08 
GeneralRe: Copy a selected gridview row to the same gridview Pin
Nathan Minier24-Mar-21 1:20
professionalNathan Minier24-Mar-21 1:20 
GeneralRe: Copy a selected gridview row to the same gridview Pin
jsc4224-Mar-21 1:25
professionaljsc4224-Mar-21 1:25 
GeneralRe: Copy a selected gridview row to the same gridview Pin
Nathan Minier24-Mar-21 1:38
professionalNathan Minier24-Mar-21 1:38 
GeneralRe: Copy a selected gridview row to the same gridview Pin
jsc4225-Mar-21 3:54
professionaljsc4225-Mar-21 3:54 
QuestionHow to able to have the information of the particular image button clicked? Pin
Member 1508474922-Mar-21 10:50
MemberMember 1508474922-Mar-21 10:50 
I am creating a book site for that, I have created dynamic buttons so that if on a particular category is clicked then that row will be fetched from the database and required information will be displayed. Now I want that if the user clicks on any particular book then the data of that book should be displayed in another panel and the current panel should hide.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.UI.HtmlControls;

namespace WebApplication1
{

<pre>
public partial class Genre : System.Web.UI.Page
{

    private int num;
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);<br />
    protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = "Romance";
        Panel2.Visible = false;

        con.Open();
        String SQL = "Select * from Book_List where Book_category='" + Label1.Text + "'";
        SqlDataAdapter da = new SqlDataAdapter(SQL, con);
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        da.Fill(ds);
        num = ds.Tables[0].Rows.Count;
        HtmlGenericControl Book = new HtmlGenericControl("div");
        Book.Attributes.Add("class", "books");
        Panel1.Controls.Add(Book);

        for (int i = 1; i < num; i++)
        {
            HtmlGenericControl myDiv = new HtmlGenericControl("div");
            myDiv.Attributes.Add("class", "myDiv");
            ImageButton image = new ImageButton();
            image.ImageUrl = ds.Tables[0].Rows[i]["Book_image"].ToString();
            image.CssClass = "Img";
            image.Click += new ImageClickEventHandler(this.image_Click);
            HtmlGenericControl content = new HtmlGenericControl("div");
            content.Attributes.Add("class", "content");
            Label name = new Label();
            name.CssClass = "name";
            name.Text = ds.Tables[0].Rows[i]["Book_name"].ToString();
            Label cost = new Label();
            cost.CssClass = "cost";
            cost.Text = "<br/> Rs " + ds.Tables[0].Rows[i]["Book_cost"].ToString();
            Button wishlist = new Button();
            wishlist.CssClass = "wishlist";
            wishlist.Text = "ADD TO WISHLIST";
            Book.Controls.Add(myDiv);
            myDiv.Controls.Add(image);
            myDiv.Controls.Add(content);
            content.Controls.Add(name);
            content.Controls.Add(cost);
            content.Controls.Add(wishlist);

        }

    }
    protected void image_Click(object sender, ImageClickEventArgs e)
    {
        ImageButton image = sender as ImageButton;
        Panel2.Visible = true;
        Panel1.Visible = false;            
    }
   </pre>

AnswerRe: How to able to have the information of the particular image button clicked? Pin
OriginalGriff22-Mar-21 11:18
mveOriginalGriff22-Mar-21 11:18 
GeneralRe: How to able to have the information of the particular image button clicked? Pin
Richard Deeming22-Mar-21 22:25
mveRichard Deeming22-Mar-21 22:25 
AnswerRe: How to able to have the information of the particular image button clicked? Pin
Richard Deeming22-Mar-21 22:33
mveRichard Deeming22-Mar-21 22:33 
AnswerRe: How to able to have the information of the particular image button clicked? Pin
DerekT-P23-Mar-21 0:46
professionalDerekT-P23-Mar-21 0:46 
QuestionC# Excel test specific cells in a column Pin
Steve Rudd22-Mar-21 5:59
MemberSteve Rudd22-Mar-21 5:59 
AnswerRe: C# Excel test specific cells in a column Pin
Gerry Schmitz22-Mar-21 7:40
mveGerry Schmitz22-Mar-21 7:40 
GeneralRe: C# Excel test specific cells in a column Pin
Steve Rudd22-Mar-21 9:31
MemberSteve Rudd22-Mar-21 9:31 
GeneralRe: C# Excel test specific cells in a column Pin
Richard MacCutchan22-Mar-21 22:56
mveRichard MacCutchan22-Mar-21 22:56 
GeneralRe: C# Excel test specific cells in a column Pin
Steve Rudd23-Mar-21 0:13
MemberSteve Rudd23-Mar-21 0:13 
GeneralRe: C# Excel test specific cells in a column Pin
Steve Rudd23-Mar-21 1:32
MemberSteve Rudd23-Mar-21 1:32 
GeneralRe: C# Excel test specific cells in a column Pin
Richard MacCutchan23-Mar-21 2:09
mveRichard MacCutchan23-Mar-21 2:09 
QuestionMike`s Gradiator Pin
Alejandro01122-Mar-21 2:22
MemberAlejandro01122-Mar-21 2:22 
AnswerRe: Mike`s Gradiator Pin
Richard Deeming22-Mar-21 2:41
mveRichard Deeming22-Mar-21 2:41 
GeneralRe: Mike`s Gradiator Pin
Alejandro01122-Mar-21 2:48
MemberAlejandro01122-Mar-21 2:48 
AnswerRe: Mike`s Gradiator Pin
Gerry Schmitz22-Mar-21 7:49
mveGerry Schmitz22-Mar-21 7:49 
GeneralRe: Mike`s Gradiator Pin
Alejandro01122-Mar-21 10:16
MemberAlejandro01122-Mar-21 10:16 
GeneralRe: Mike`s Gradiator Pin
Alejandro01123-Mar-21 14:53
MemberAlejandro01123-Mar-21 14:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.