Hi guys,
I'm using a gridview to do some inline editing. The data binds okay,
its goes into edit mode and cancel okay. I'm using my own custom
commandName, "save", and it picks this up okay. Don't want to use the
built in "update" command. Trouble is when I go to access the form
fields (textboxes etc), there isn't any data there (ie text in the
textbox), I can access them though, I guess I'm missing an event
somewhere.
I've stripped out the necessary bits of code that i've used and added
it below.
Any ideas most appreciated, driving me nuts.
Regards.
**** UI ****
..
..
..
<asp:TemplateFi eld HeaderStyle-Width="150">
<ItemTemplate>< %# Eval("EmailAddr ess") %></ItemTemplate>
<EditItemTempla te>
<asp:TextBox ID="txtEmailAdd ress" runat="server" Text='<%#
Eval("EmailAddr ess") %>' />
</EditItemTemplat e>
</asp:TemplateFie ld>
<asp:TemplateFi eld ItemStyle-Width="80" ItemStyle-
HorizontalAlign ="Right">
<ItemTemplate >
<asp:LinkButt on CommandName="Ed it" CommandArgument ='<%#
Container.DataI temIndex %>' runat="server">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Content/Images/
document_edit.p ng" />
</asp:LinkButton>
</ItemTemplate>
<EditItemTempla te>
<asp:LinkButt on CommandName="Sa ve" CommandArgument ='<%#
Container.DataI temIndex %>' runat="server">
<asp:Image ID="Image2" runat="server" ImageUrl="~/Content/Images/
document_ok.png " />
</asp:LinkButton>
<asp:LinkButt on CommandName="Ca ncel" CommandArgument ='<%#
Container.DataI temIndex %>' runat="server">
<asp:Image ID="Image3" runat="server" ImageUrl="~/Content/Images/
undo.png" />
</asp:LinkButton>
</EditItemTemplat e>
</asp:TemplateFie ld>
<asp:ObjectData Source .... SelectMethod="G etAlarms" .... />
**** code behind ****
protected void RowCommand(obje ct sender, GridViewCommand EventArgs e)
{
int index = int.Parse(e.Com mandArgument.To String());
GridViewRow row = gvData.Rows[index];
switch (e.CommandName. ToLower())
{
case "save":
UpdateAlarmMapp ing(row);
gvData.EditInde x = -1;
gvData.DataBind ();
break;
}
}
private void UpdateAlarmMapp ing(GridViewRow row)
{
Alarm alarm = new Alarm();
alarm.Enabled = ((CheckBox)row. Cells[2].Controls[0]).Checked;
alarm.EmailAddr ess =
((TextBox)row.F indControl("txt EmailAddress")) .Text;
alarm.MobileNum ber =
((TextBox)row.F indControl("txt MobileNumber")) .Text;
alarm.AlarmNo =
int.Parse(((Lit eral)row.FindCo ntrol("litAlarm No")).Text);
bool ok = alarm.SaveAlarm Mapping();
} 2 1427
Seems JQuery is causing some kind of conflict, I have my gridview in a
modal "window" (ie, div), a bunch of stuff is injected into the DOM
when it finds the div id containing my grid - i remove the call to do
this and it works fine
Now I have a different problem...
Sorted.
Seems jquery UI dialog will tear the div containing my gridview out
from where it was in the DOM and inject it directly onto the BODY tag.
So, because it's outside of the FORM tag, the fields weren't getting
posted during postback
Was able to get around this by editing the jquery library itself and
appending the dialog to the form id "aspnetForm ".
Changed .appendTo(docum ent.body) to .appendTo('#asp netForm')
Seems to work so far :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Hans Merkl |
last post by:
Hi,
Is there a way to show the column headers of a GridView control even if
there is no data? The only thing I see is the EmptyDataTemplate but I would
also like to display the column headers.
Thanks
Hans
|
by: |
last post by:
Hello,
Does anyone have an idea on how I can filter the data in the gridview
control that was returned by an sql query?
I have a gridview that works fine when I populate it with data. Now I want
to look at that data and filter it based on what is in it.
I know that this could have been done with data sets and data views in
asp.net 1.1 but how is this done now in asp.net 2.0?
|
by: Ken |
last post by:
Hi All -
I have a filtered GridView. This GridView has a check box in the first
column. This check box is used to identify specific rows for delete
operations.
On the button click event I loop through the filtered GridView to identify
the selected rows and assemble some XML to be sent to a stored proc.
The problem I have is that when looping through the GridView, it doesn't
|
by: Mark Olbert |
last post by:
I ran into a situation this morning where the RowUpdating event of a GridView kept insisting there were no entries in either the
OldValues or NewValues dictionaries. The GridView is bound to a strongly-typed collection, derived from CollectionBase, through the
control's datasource property at runtime.
From some googling it appears that, at least in the release candidate for NET2 this was a known bug; only binding to DataSources
lets those...
|
by: Jon S via DotNetMonster.com |
last post by:
HI all,
I'm returning a dataset to a gridview control. When the gridview asp.net
control is populated from the returning dataset some of the cells remain
empty. This is expected as some data in the dataset is empty. The cells
that are empty, in the gridview control, I would like to have the value of 0
(zero) inserted. Is there a default cell value property or something similar
for the asp.net gridview control. So if no data is...
| |
by: Sean |
last post by:
I am using a GridView to display and edit rows of data. I am having
problems with one of my GridViews that has a Calendar control in it. If
the data coming back from the DB doesn't have a date for this field, I
get a 'Specified Cast is Invalid' message when the empty string is
being bound to the SelectedValue of the Calendar control. That makes
sense.
What I need to do (I think), is somehow intercept the process so that
if I have a DB...
|
by: pblack9455 |
last post by:
I have a simple requirement to bind a small ArrayList of (ItemLine) Objects
to a GridView control. The Gridview renders on the page and allows me to
click update/edit buttons...however the data does not change, and in the
updated and updating row events the newValues collections are empty!!!
I've tried various other methods such as using an ObjectDataSource, but my
ArrayList does not existing in a database until after the editing and...
|
by: Cindy Lee |
last post by:
When I do a sorta on 1 table, then the other table goes back to the original
order.
What can I set so, it keeps the order of the other current gridview's order.
I set all the gridview values in my 'onpageload' in the cs file.
|
by: =?Utf-8?B?UGF1bA==?= |
last post by:
Hi I have a gridview control with a template column that has a textbox and
when the control is bound to the datasource the textbox is filled ok.
I then change what is in the textbox in the gridview control and in the
gridview_RowDataBound event I have
string DiscDescrip =
Convert.ToString((e.Row.Cells.FindControl("txbxDiscgv") as TextBox ).Text);
This returns what was initially loaded in the textbox but not what I had
just changed it...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |