|
Hello all,
I am using an infragistics webdatagrid. I am populating the grid using a method which fetches the data directly from the database. I have added two template columns, one containing the delete button and the other containing the update button. Now my issue is, I want to update a row when I click the update button for that row. The button click should call a server side update method that will update the data edited in the grid directly in the database without using any AJAX or javascript and there should be a postback. Similarly when I click the "Delete" button for a particular row it should delete the row directly from the database and refresh the whole page without calling any AJAX functionality or javascript. This functionality can be easily achieved in ASP.net datagrid but I am not sure how this can be achieved using the infragistics WebDataGrid. Following is the code for the grid. Please have a look at it and let me if I am missing anything in it. Also let me know if you need more details on this.
<ig:WebDataGrid ID="grdUsers" runat="server" Height="175px" Width="650px" AutoGenerateColumns="False"<br />
BorderWidth="2px" OnLoad="grdUsers_Load" DataKeyFields="User_ID" OnRowsDeleting="grdUsers_RowDeleting"<br />
OnCellSelectionChanged="grdUsers_CellSelectionChanged" OnItemCommand="grdUsers_ItemCommand"<br />
OnRowUpdating="grdUsers_RowUpdating" EnableAjax="False" Enabled="true" <br />
onprerender="grdUsers_PreRender"><br />
<EditorProviders><br />
<ig:WebTextEditProvider ID="BasicTextProvider" /><br />
<ig:WebNumericEditProvider ID="numPhoneNumber" /><br />
<ig:DropDownProvider ID="drpRoles"><br />
<EditorControl ID="editorRoles" runat="server" DisplayMode="DropDownList" TextField="VALUE"<br />
ValueField="ID" Width="200px" DataKeyFields="User_ID"><br />
<DropDownItemBinding TextField="VALUE" ValueField="ID" /><br />
</EditorControl><br />
</ig:DropDownProvider><br />
</EditorProviders><br />
<Columns><br />
<ig:BoundDataField DataFieldName="Role_Name" Header-Text="User Role" Key="keyRoleName"><br />
<Header Text="User Role"></Header><br />
</ig:BoundDataField><br />
<ig:BoundDataField DataFieldName="First_Name" Header-Text="First Name" Key="keyFirstName"><br />
<Header Text="First Name"></Header><br />
</ig:BoundDataField><br />
<ig:BoundDataField DataFieldName="Last_Name" Header-Text="Last Name" Key="keyLastName"><br />
<Header Text="Last Name"></Header><br />
</ig:BoundDataField><br />
<ig:BoundDataField DataFieldName="User_Email" Header-Text="Email Address" Key="keyUserEmail"><br />
<Header Text="Email Address"></Header><br />
</ig:BoundDataField><br />
<ig:BoundDataField DataFieldName="Mobile_Number" Header-Text="Mobile Number" Key="keyMobileNumber"><br />
<Header Text="Mobile Number"></Header><br />
</ig:BoundDataField><br />
<ig:TemplateDataField Key="UpdateItem" Width="60px"><br />
<ItemTemplate><br />
<asp:Button runat="server" ID="btnUpdate" Text="Update" CommandName="UpdateID" OnClick="btnUpdate_Click1"<br />
UseSubmitBehavior="false"/><br />
</ItemTemplate><br />
</ig:TemplateDataField><br />
<ig:TemplateDataField Key="DeleteItem" Width="60px"><br />
<ItemTemplate><br />
<asp:Button runat="server" ID="btnDelete" Text="Delete" OnClientClick="javascript:alert('The user is deleted.');"<br />
UseSubmitBehavior="false"/><br />
</ItemTemplate><br />
</ig:TemplateDataField><br />
</Columns><br />
<Behaviors><br />
<ig:Activation /><br />
<ig:Selection RowSelectType="Multiple" CellClickAction="Row" /><br />
<ig:EditingCore AutoCRUD="True"><br />
<Behaviors><br />
<ig:RowDeleting Enabled="true"></ig:RowDeleting><br />
<ig:CellEditing Enabled="true"><br />
<EditModeActions EnableF2="true" EnableOnActive="true" MouseClick="Single" /><br />
<ColumnSettings><br />
<ig:EditingColumnSetting ColumnKey="keyRoleName" EditorID="drpRoles" /><br />
<ig:EditingColumnSetting ColumnKey="keyFirstName" EditorID="BasicTextProvider" /><br />
<ig:EditingColumnSetting ColumnKey="keyLastName" EditorID="BasicTextProvider" /><br />
<ig:EditingColumnSetting ColumnKey="keyMobileNumber" EditorID="BasicTextProvider" /><br />
</ColumnSettings><br />
</ig:CellEditing><br />
</Behaviors><br />
</ig:EditingCore><br />
</Behaviors><br />
</ig:WebDataGrid>
Happy coding!!!
|
|
|
|
|
Hello
I want to lock a web application (asp.net) by domain.
If the user try to install the website on another domain that was specific by the owner so the website will not work.
Thanks for your consideration
Mohammad Khansari
|
|
|
|
|
Pass every request through a common HttpHandler, and check the domain there.
You can also have this logic inside your installer.
|
|
|
|
|
thanks
how to protect that http handler (or httpModule)?
It's very simple to unlock that!
Now what to do?
Mohammad Khansari
|
|
|
|
|
are you going to give him the code??
If not, place the logic in the BasePage, and inherit everypage from your basepage.
|
|
|
|
|
Hi,
I created an web application that read emails from GMAIL and store it in the local database. My problem is that when I store the email in my database they should be MARK AS READ on the server because it is loading the emails again and again because the status of those mails are still unread.
Please help me in this regard.
Thanks in advance.
|
|
|
|
|
set some boolean for the read and the unread mail.... when the mail is read set the boolean as 1 and if is not read then set to 0.
|
|
|
|
|
I think that option should be in GMAIL, and it already has that.
If you download mails properly, it will start download after the last downloaded mail from your account. See how outlook does.
|
|
|
|
|
Hi,
I am inserting data from excel sheet to sql server table.
The following is the code which is used to export data from excel ti sql server table.
private void insdata()
{
try
{
string filename = "~\\Documents\\" + ViewState["MissionCat"];
string excelConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath(filename) + "; Extended Properties=\"Excel 8.0;HDR=YES;IMEX=1;\"";
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
connection.Open();
OleDbCommand command = new OleDbCommand("Select [Mission] ,[Civilian] ,[Military] ,[Police]" +
",[Unknown] ,[Non-UN] ,[Total] FROM [Sheet1$]", connection);
string sqlConnectionString = ConfigurationManager.ConnectionStrings["conn"].ToString();
SqlConnection cnntrunc = new SqlConnection(sqlConnectionString);
SqlCommand truntbleBU = new SqlCommand();
truntbleBU.Connection = cnntrunc;
string trunsqlBU = null;
trunsqlBU = "TRUNCATE TABLE MissionCatReport";
truntbleBU.CommandText = trunsqlBU;
cnntrunc.Open();
truntbleBU.ExecuteNonQuery();
cnntrunc.Close();
using (DbDataReader dr = command.ExecuteReader())
{
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "MissionCatReport";
bulkCopy.WriteToServer(dr);
}
}
}
}
catch (Exception ex)
{
throw ex;
}
}
There is numeric field in table such as total.
Now i am getting an error when a user tries to export data from excel to sql table if the total column in excel sheet contains string value instead of numeric value because the total column in sql table is numeric. I want to keep the total column in sql table numeric.
I am getting the follwoing error.
The given value of type String from the data source cannot be converted to type int of the specified target column.
so before inserting data in to sql table i want to make a check that whether the excel column contains the right data.
Is it possible to check that, and if yes can anyone tell me how to do that check.
Pranav Dave
|
|
|
|
|
Well, the problem is you cant get total as no data is stored within the Total, rather it holds only the Formula. Rather you have to calculate the total yourself in SQL.
|
|
|
|
|
I have to store comments from webpage visitors. I used textbox to get comment from users and sql DB. The textbox's textmode is Multiline and how to store & retrive comment from sql DB to textbox and vice versa.
|
|
|
|
|
Just get the Text of the textbox,
Call Database and store the data.
Can you be specific what problem you are having in this?
|
|
|
|
|
I can get text from textbox and i can able to store it in DB. But when i retrive it i can't retrive it.But when i store text in a single line i can able to retrive it.
|
|
|
|
|
Means?
You cant retrieve data from the database when there is multiline text??
Do
Select ColmnName from tablename <br />
now assign the text into the textbox, thats it.
|
|
|
|
|
use the normal insert query and select query as you use for the noraml textbox the only difference is increase the size of the varchar in which you are storing the value(text).
|
|
|
|
|
I want to create a social site which can have some features like forum,news and events,rss feeds,blogs.could any one provide built in code for these features.
N!dh!
|
|
|
|
|
|
|
How to add search option in asp.net website?
|
|
|
|
|
with code. This is a crazy question. It has no real answer. If your data is in a database, search it with SQL. If it's not, then it depends, the easiest way, is to get google to search your site.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
U know that for every website there will search box. Like that i have to add search option to my website. Is there any default controls in asp.net or we have to add code?
|
|
|
|
|
kavinnagarajan wrote: Is there any default controls in asp.net or we have to add code?
Control for search? Search is just a text box and a button. Do you find it hard to add those controls?
|
|
|
|
|
If u have some sample code for searching please provide for me.
|
|
|
|
|
If you want to be a programmer, then you will need to learn to write code. If you had even a basic understanding of programming, you'd know that you can't expect to just drop some control in there and get search functionality from it, that's just not possible.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
You need to add code of course.
You can also use Google Custom Search if you need to search only pages inside your website.
|
|
|
|