Click here to Skip to main content
15,891,864 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
pmarfleet18-Mar-08 12:17
pmarfleet18-Mar-08 12:17 
QuestionRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Phivos Stylianides18-Mar-08 12:26
Phivos Stylianides18-Mar-08 12:26 
GeneralRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Not Active18-Mar-08 12:48
mentorNot Active18-Mar-08 12:48 
QuestionRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Phivos Stylianides18-Mar-08 13:06
Phivos Stylianides18-Mar-08 13:06 
GeneralRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Not Active18-Mar-08 14:19
mentorNot Active18-Mar-08 14:19 
QuestionRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Phivos Stylianides18-Mar-08 15:06
Phivos Stylianides18-Mar-08 15:06 
GeneralRe: INSERT IMAGES TO SQL SERVER TABLE USING C# CODING Pin
Not Active18-Mar-08 15:53
mentorNot Active18-Mar-08 15:53 
General"Unable to cast object of type " in Gridview control when click on add button [modified] Pin
amistry_petlad18-Mar-08 9:51
amistry_petlad18-Mar-08 9:51 
Hi!
I have used Editable Gridview control in which I have put Add category button,On the above of control
The first column of grid view is primary key ProductId and sec. is productname. On the Product name I have replace Hyperlink in place of bound contol. so on the click i can navigate on some other page the problem is that when I click on add button the Hyperlink can not change in the bound control so i cant got the Textbox and so its give the following error.

"Unable to cast object of type 'System.Web.UI.WebControls.HyperLink' to type 'System.Web.UI.WebControls.TextBox'."


<br />
<br />
if (((LinkButton)GridView1.Rows[0].Cells[2].Controls[0]).Text == "Insert")<br />
        {<br />
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MYConnectionString"].ConnectionString);<br />
            SqlCommand cmd = new SqlCommand();<br />
            cmd.CommandText = "INSERT INTO Products(cat_name) VALUES(@cat_name)";<br />
            cmd.Parameters.Add("@cat_name", SqlDbType.VarChar).Value = ((TextBox)GridView1.Rows[0].Cells[1].Controls[0]).Text;<br />
            cmd.Connection = con;<br />
            con.Open();<br />
            cmd.ExecuteNonQuery();<br />
            con.Close();<br />
        }<br />


modified on Tuesday, March 18, 2008 4:13 PM

GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
pmarfleet18-Mar-08 11:19
pmarfleet18-Mar-08 11:19 
GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
Not Active18-Mar-08 11:35
mentorNot Active18-Mar-08 11:35 
QuestionRe: "Unable to cast object of type " in Gridview control when click on add button Pin
amistry_petlad18-Mar-08 13:32
amistry_petlad18-Mar-08 13:32 
GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
Not Active18-Mar-08 14:20
mentorNot Active18-Mar-08 14:20 
GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
amistry_petlad19-Mar-08 5:04
amistry_petlad19-Mar-08 5:04 
GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
Not Active19-Mar-08 5:57
mentorNot Active19-Mar-08 5:57 
GeneralRe: "Unable to cast object of type " in Gridview control when click on add button Pin
amistry_petlad20-Mar-08 3:36
amistry_petlad20-Mar-08 3:36 
GeneralFormView Not Inserting Pin
Brady Kelly18-Mar-08 7:50
Brady Kelly18-Mar-08 7:50 
GeneralRe: FormView Not Inserting Pin
Brady Kelly18-Mar-08 8:40
Brady Kelly18-Mar-08 8:40 
GeneralCheck all - checkbox Pin
nour12318-Mar-08 6:53
nour12318-Mar-08 6:53 
GeneralRe: Check all - checkbox Pin
Not Active18-Mar-08 7:08
mentorNot Active18-Mar-08 7:08 
GeneralRe: Check all - checkbox Pin
nour12318-Mar-08 19:26
nour12318-Mar-08 19:26 
GeneralRe: Check all - checkbox Pin
pmartike18-Mar-08 20:36
pmartike18-Mar-08 20:36 
GeneralRe: Check all - checkbox Pin
Not Active19-Mar-08 1:16
mentorNot Active19-Mar-08 1:16 
GeneralRe: Check all - checkbox Pin
nour12319-Mar-08 4:02
nour12319-Mar-08 4:02 
Generalpattern and practices Pin
raquidd2218-Mar-08 6:30
raquidd2218-Mar-08 6:30 
GeneralRe: pattern and practices Pin
Not Active18-Mar-08 7:03
mentorNot Active18-Mar-08 7:03 

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.