|
after selecting the rows through checkbox in first gridview and transfering them to second gridview i want the selected rows to get deleted from the first gridview..i want to delete the rows only in the front end and not from database since i have used sql data source to fill the first gridview..is this possible..below is the code which i have used..
foreach (GridViewRow row in GridView1.Rows)
{
string upstr = "UPDATE emp SET flag = '1' WHERE empId = ";
CheckBox ch = (CheckBox)(row.FindControl("chkbx1"));
if (ch.Checked == true)
{
int Id = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
idArr.Add(Id);
upstr += "'" + Id + "'";
conn = new SqlConnection(constr);
conn.Open();
SqlCommand comm = new SqlCommand(upstr, conn);
comm.ExecuteNonQuery();
conn.Close();
GridView1.DeleteRow(Id);
ch.Checked = false;
}
}
when i am compiling this am getting ""Deleting is not supported by data source 'empReq' unless DeleteCommand is specified."
scarface
|
|
|
|
|
Have you written the deletecommand in the property like deletecommand="delete from table where rowid=2 ";
|
|
|
|
|
but i want the rows to be deleted only from front end and not from database..is it possible..
scarface
|
|
|
|
|
Then i think put the data in an xml format or any dataset.whichever rows you select for delete, delete them from the dataset.Then bind it to Grid.
|
|
|
|
|
can you just show some sample code for this..
scarface
|
|
|
|
|
<asp:gridview id="GridView1" runat="server" onsorting="GridView1_Sorting" xmlns:asp="#unknown">
<columns> <asp:templatefield>
<itemtemplate>
<asp:checkbox id="CheckBox1" runat="server" autopostback="true" oncheckedchanged="CheckBox1_CheckedChanged">
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
CheckBox chk = (CheckBox)sender;
GridViewRow myrow = (GridViewRow)chk.NamingContainer;
myrow.Visible = false;
}
god is great
|
|
|
|
|
Hello Friends,
I'm creating a shared assembly. I've created an library file and also created an unique strong name but now not getting Assemblyinfo.cs for adding the assemblykey file. So please let me know how can i get it.....
|
|
|
|
|
Hi Experts,
I am using Gmap Control for selecting a place by user..I am placing marker on click event.
But the problem comes,when user clicks second time the second marker is creating.. I want to remove marker and i want to place newmarker..
how can i do that..
Thanks
|
|
|
|
|
There's tons of sample code, and a mailing list/forum, on the gmaps site.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I have developed the website which connects sql server using windows authentication. It works fine in local. but when i deploy it in online it shows error while connecting with the sql. The error is "Login failed for user 'C60536-52290\IUSR_ADSTESTSERVER'".
When i search in google i found to change in IIS as "Disable anonymous access" . I have changed and gave apply it opens a windows as "Inheritance Overrides" The following child nodes also defines the values of the UNCPassword property whcih overrides the value you have just set.Please select from the list below those nodes which should use the new value. The list are sitemap.xml,ror.xml,generator/data.
Can any one help me to solve this problem
Thanks
|
|
|
|
|
Hi,
I have a webapplication(Ajax Enabled asp.net web application) in which i have only a plane Default.aspx file along with web.config.....and using setup and Deployment i have created an msi.. and i deployed it on the other system....and im able get the below error..
Exception Details: System.Security.SecurityException: Requested registry access is not allowed.
By the way i have not written any code in the cs file....Please help me out...
While deploying(ie while creating msi) i kept my dll"s in bin folder and set the Execute permissions property of bin folder to vsdepScriptsAndExecutables...and added the project output(primary out put and content files)to the setup project..and after building the setup project i took the msi file and installed in other system and im able to get the above error...
|
|
|
|
|
do you install as admin ?
Why do you need an msi to install a web app ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Yes im installing as admin...
im creating as msi bcos it is going to use by the service person who is not aware of creating virtual directory stuff...please let is it not a better practice to create an msi for a web application...i guess but im not sure that i need to set something for my webapplication properties when it is dumped in inetmgr..ie under Default websites...
|
|
|
|
|
project output/primary in bin folder is not enough. Add the ajax files and it will work. That is what I am doing. Hope this helps.
|
|
|
|
|
ya i have added system.web.extensions and System.web.Extensions.Design and Ajaxcontroltoolkit.dll.....still it"s giving the same error...
|
|
|
|
|
Hi
I am developing a web application in ASP.Net 2.0
I have a web page for project registration in which I can add project details like Project code, name description,start date, end date etc. I want to include in this page the project members and roles.
I have added a table with 2 columns which contains combo boxes bounded to Project member table and roles table. Also a button to add new member. On click of the add button i create new row to the table with combo box controls bounded to project members and roles. But I cannot retrieve the selected values of the dynamically added controls.
Can any one please help me to solve this.
With kind regards,
Jimi
|
|
|
|
|
Dynamically created controls need to be created before page load in order for viewstate to populate. OR you need to use hidden controls to store the values you want.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
All these questions are asked almost daily. How about writing a ASP.NET FAQ article?
|
|
|
|
|
Like they would read it.....
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks.
I got it solved using dynamic gridview.
|
|
|
|
|
|
This is the ASP.NET forum. ASP is so far out of date, it's not funny. No-one seriously uses it unless they have to. If you're stuck with it, my deepest sympathy, try the web dev forum. If you're not stuck, run for your life, buy an ASP.NET book.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi all,
i need to get the text of a cell in a datagrid control, whose column Visible property is set to false (i dont want to display that column to the user: just contains a code number and eats space on the screen). This datagrid is data bounded to a ObjectDataSource control.
i try the following without success:
GridView_1.SelectedRow.Cells[0].Text
(on debug, i see the property Text as "")
is there a workaround to get the selected cell value without turning column's Visible property to true?
Thanks in advance.
|
|
|
|
|
if you set Visible property of the column to false, that column will not rendered. That is why you getting String.Empty when you query the cell value.
The work around is to use css to hide the column from the user. Now you can access the cell value the same way as you access the visible=true columns.
First define your css, example
<style type="text/css">
.columnHidden
{
display:none;
}
.columnVisible
{
display:block;
}
</style>
Now use the css to hide your columns
<asp:boundfield datafield="PID" itemstyle-cssclass="columnHidden" />
Yusuf
modified on Monday, March 2, 2009 6:13 PM
|
|
|
|
|
Hi Yusuf,
thanks a lot, very well explained.
|
|
|
|