I have corrected my statement and this time I'm getting this error: "Object reference not set to an instance of an object." And the error source: Line 219: myCommand.CommandText="select * from dbo.DashBoard where Name Like @Billing"; Line 220: myCommand.Parameters.Add(new SqlParameter("@Billing",SqlDbType.VarChar,50)); Line 221: myCommand.Parameters["@Billing"].Value= bc.Text; Line 222: SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand); Line 223: DataSet ds = new DataSet(); This is my code: My code behind: private void dgoperation_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { System.Web.UI.WebControls.LinkButton bc=new System.Web.UI.WebControls.LinkButton(); bc=(System.Web.UI.WebControls.LinkButton)e.Item.Cells[0].FindControl("TeamBĀilling"); SqlCommand myCommand=new SqlCommand(); myCommand.Connection=con; myCommand.CommandText="select * from dbo.DashBoard where Name Like @Billing"; myCommand.Parameters.Add(new SqlParameter("@Billing",SqlDbType.VarChar, 50)); myCommand.Parameters["@Billing"].Value= bc.Text; SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds); dgis.DataSource=ds; dgis.EditItemIndex = -1; dgis.DataBind(); } How can I solve this? Thanks
nclauder
Posts
-
Button Column Select. -
Button Column Select.Hi all, I have a datagrid with Button column select in form of hyperlink. On the same page, I have another datagrid that insert data and one column(Name) has Names of a user that is inserting data(using windows authentication). Now this is how it's supposed to work: When any user want to see data about a particular user it's a matter of selecting his name and the data Writen by the selected user should be the only ones to be shown. I got some examples on Google but they all seem not to be working. When a user is selected the page remains the same data is not selected. How would can I solve this problem? My code looks like this: HTML part: and code behind: private void dgoperation_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { SqlCommand myCommand=new SqlCommand(); myCommand.Connection=con; myCommand.CommandText="select * from dbo.DashBoard where Name = @Billing"; myCommand.Parameters.Add(new SqlParameter("@Billing",SqlDbType.VarChar,50)); myCommand.Parameters["@Billing"].Value= dgbilling; SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds); dgis.DataSource=ds; dgis.EditItemIndex = -1; dgis.DataBind(); } dgis: this is the datagrid that where user inserts data. dgbilling: this is the datagrid with the name list. Thanks.
-
HyperlinkColumn!Hi all, I have this big problem with hyperlinks I would appriciate any help please. My web site has two datagrids on the same page. And one has a list of names of the users which are in a HyperlinkColumn. The second datagrid is for inserting data, and when a user inserts data I used 'Windows Authentication' for names in one column called Name. Now this is how it's supposed to work: When any user want to see data about a particular user it's a matter of selecting his name and the data Writen by the selected user should be the only ones to be shown. I got some examples on Google but they all seem not to be working. When a user is selected the URL changes instead of the particular rows in the datagrid to be selected. For example the original url is "http://localhost/Dash\_Board/DashBoard.aspx" and if I select user Claude the URL change into "http://localhost/Dash\_Board/Claude" and get an error The page cannot be found. Why would this be happening? My code looks like this: HTML part: and code behind: private void dgbilling_SelectedIndexChanged(object sender, System.EventArgs e) { SqlCommand myCommand = new SqlCommand("select * from dbo.DashBoard where Name = @Billing",con); SqlParameter myparam = new SqlParameter("@Billing",SqlDbType.Text); myparam.Value="../Dash_Board/DashBoard.aspx?,Name{0}"; myCommand.Parameters.Add(myparam); SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand); DataSet ds = new DataSet(); myAdapter.Fill(ds); dgis.DataSource=ds; dgis.EditItemIndex = -1; dgis.DataBind(); } dgis: this is the datagrid that where user inserts data. dgbilling: this is the hyperlinkcolumn. Thanks.
-
Problem with hyperlinksHi Guffa, Been away for a while but I'm now back. What I ment by not working, when I select the hyperlinks text the semilar columns are not selected at all nothing changes. that's where my trouble is situated. Thanks.
-
Problem with hyperlinksHi all, I have this big problem with hyperlinks I would appriciate any help please. My web site has two datagrids on the same page. And one has a list of names of the users which are in form of hyperlinks. The second datagrid is for inserting data, and when a user inserts data I used 'Windows Authentication' for names in one column called Name. Now this is how it's supposed to work: When any user want to see data about a particular user it's a matter of selecting his name and the data about the selected individual should be the only ones to be shown. I got some examples on Google but they all seem not to be working. Tha's why I'm here for help please! Here is where I've reached: HyperLink I really appriciate all the help. Thanks.
-
Hyperlinks in datagrid!Thanks Kubben, It's close to that only that it does not selects What the selected person wrote in the insert Datagrid. other wise now in the view source the URL looks like this: Claude Thanks.
-
Hyperlinks in datagrid!Hi all, I have two datagrid, one has a list of allowed user of the second datagrid. The second datagrid is an inserting datagrid and it Function properly. Now where my problem is I need to be able to select a particular name and will be able to see whatever the Particular selected user has been inserting in the insert datagrid. So I made the names in Hyperlink and and this is the code I'm using but it's not to be working: When I press the Name nothing changing. Where could be the problem? Thanks.
-
Path errorI'M HAVING THIS PROBLEM WITH MY WEBSITE, I DEPLOYED IT ON TO TE SERVER AND ON THE SERVER IT WORKS WELL BUT WHEN i TRY TO INSERT DATA WHEN ON CLIENT I GET THIS ERROR: [COMException (0x80070035): The network path was not found] System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) +705 System.DirectoryServices.DirectoryEntry.Bind() +10 System.DirectoryServices.DirectoryEntry.get_AdsObject() +10 System.DirectoryServices.PropertyValueCollection.PopulateList() +234 System.DirectoryServices.PropertyValueCollection..ctor(DirectoryEntry entry, String propertyName) +56 System.DirectoryServices.PropertyCollection.get_Item(String propertyName) +97 Dash_Board.DashBoard.dgis_ItemCommand(Object source, DataGridCommandEventArgs e) in c:\inetpub\wwwroot\dash_board\dashboard.aspx.cs:156 System.Web.UI.WebControls.DataGrid.OnUpdateCommand(DataGridCommandEventArgs e) +109 System.Web.UI.WebControls.DataGrid.OnBubbleEvent(Object source, EventArgs e) +507 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26 System.Web.UI.WebControls.DataGridItem.OnBubbleEvent(Object source, EventArgs e) +106 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +26 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +121 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +115 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +138 System.Web.UI.Page.ProcessRequestMain() +1292 Thanks.
-
Error!The problem was actually in the code behind. But now I have solved it I was adding: InsertEmpty(); yet I was not supposed But now I'm facing another error after deploying it on server it works properly but when on the client side the user tries to insert data an error occurs: Exception Details: System.Runtime.InteropServices.COMException: The network path was not found Why would this happened. Thanks
-
Error!Hi all, I have this problem with my website, when I insert data I get an error Specified cast is not valid. And this is the source error: What could be the problem? Thanks
-
Problem with two images!Why is it that when I insert data I fast get an error : Specified cast is not valid. But When I run it the second time I find the data was saved the right image was selected! Actually I can say every thing works well apart that when I atempt to insert data this error appears: Specified cast is not valid. on line: . Thanks
-
Problem with two images!Thanks Guffa It has worked. This is how it worked I had to select Bad Mood By default and the code would be: Thanks a lot.
-
Problem with two images!Hi all, I have two images in ItemTemplate one is sad.gif the other is laughing.gif. In EditItemTemplate I have a RadiobuttonList that Has two RadioButtons one is Good Mood and Bad Mood. The way it works When one selects the Bad Mood RadioButton Image sad.gif is selected and if Good Mood RadioBuuton laughing.gif is selected. and this is how I'm coding it: The Problem is whether Bad Mood or Good Mood is selected only image.gif appears can some one help me out please? Thanks
-
Problem with two images!I have two Images that are in Itemtemplate one is sad.gif then the other is laughing.gif. then in EditItemTemplate is a RadioButtonList with two RadioButtons Good Mood and Bad Mood. all are in the same column. This is how it is supposed to work when Good Mood is selected, and insert button is pressed, the image laughing.gif is to be chosen. This code was supposed to work but I don't understand why it's not working: But whether I select Good Mood or Bad Mood only the image laughing.gif is selected. Where could I be going wrong? Thanks
-
Error!In sqlserver database. Thanks
-
Error!Hi, Im inserting into one column image at the same time text. but when I insert data I get this error: Specified argument was out of the range of valid values. Parameter name: Images/laughing.gif Why is it so? Thanks
-
Error!Hi, Im inserting into one column image at the same time text. but when I insert data I get this error: Specified argument was out of the range of valid values. Parameter name: Images/laughing.gif Why is it so? Thanks
-
Image.HI, Which Data Type accepts both image and character in one sql column? Thanks
-
Relative address!Hi, Who could help me and show me a simple example how to use relative addressing. Thank you.
-
Path errorHi enjoycrack, I've just realised something funny would you Be knowing why when the website is on server The images are not seen? I get an X where Image is supposed to appear. Thanks