I am working porting ugly .NET 1.1 DataGrids to 2.0 GridViews. The GridView fills correctly via SqlDataSource. When I click Edit -> [make a field change] -> Update, the page refreshes but the update command clearly never fired. (Putting stuff in the GridView's OnRowUpdating function proves this.) The row also remains in edit mode.
The code:
[code=html]<asp:SqlDataSou rce ID="dsMyReports " runat="server"...
User Profile
Collapse
-
GridView Update Not Firing
-
This is actually a very good idea. It just requires an extra minute of effort to get working in the CodeIgniter PHP framework. Something like this in the controller:
[code=php]
function myTabsPage($ban ner) // '1' as URL parameter automatically put in $banner
{
$data['display'] = $banner == 1 ? 'none' : 'block';
$this -> load -> view('myView', $data);
}
[/code]
... -
Detecting IFRAME Container
I have a page that can be accessed either directly or by an AJAX tabs interface (courtesy jQuery). If accessed directly, I want the page's banner to be visible. If indirectly, the banner needs to be not displayed ('display:none' ).
If AJAX and IFRAMEs weren't involved, a containing object would be a pretty easy thing to detect. Since I'm using jQuery, though, I'm having trouble.
Any suggestions? Thanks. -
Reading A File Via Stream
One function in this fabulous DLL requests a file read in the form of the Stream class...not StreamWriter or StreamReader or MemoryStream, just Stream. Since Stream is abstract, this makes it hard. I've done my best to bounce from Stream to MemoryStream to whatever else, but it just isn't working out. Here's all I have so far, which isn't much. Can someone fill in the blanks? Thanks!
[code=cpp]
public void GetData()
{... -
It's a mixture of RequiredFieldVa lidators and RegularExpressi onValidators. Any fields with errors have red asterisks appear beside them; errors are listed in the ValidationSumma ry up top:
[code=html]
<form id="form1" method="POST" action="" runat="server">
<div style="width:10 0%">
<asp:Validation Summary ID="ValidationS ummary1"...Leave a comment:
-
Right. Since these controls were working as expected earlier, AutoPostBack was and still is set to true....Leave a comment:
-
I normally supply code with my questions, but as I said, I didn't find anything of worth in Page_Load(), so I left it off. But you're welcome to it. As a bonus is a DropDownList also not responding to postback; it should enable a TextBox when 'Other' is chosen:
[code=cpp]
protected void Page_Load(objec t sender, EventArgs e)
{
// enable/disable secondary contact fields based on checkbox status
Panel1.Enabled...Leave a comment:
-
Validation Breaks Postback (C#)
Before I added validation features, I had a few controls that made use of postback: for example, click a checkbox to make Panel1 and subcontrols visible.
I've since added clientside and serverside validation and suddenly postback is broken. Only if 'Submit' is clicked does the form update with changes that should have occured automatically.
Page_Load() has nothing involving IsPostBack, so I have no idea what else could... -
I think I figured out the source of the problem.
When there are validation controls in place, the page blocks a button click event when something isn't filled in right and pulls up a validation dialog using Javascript or somesuch. As long as there's a validation violation, there's no postback and no call of Button_Click() -- anything I put in the codebehind to check data myself won't get used.
So now the question becomes:...Leave a comment:
-
<div> any thinner than 100% width centres differently from <span>. The only way I've found to centre a <div> is to nest them:
[code=html]
<div style="width:10 0%">
<div style="margin-left:auto;margi n-right:auto">Hi there</div>
</div>
[/code]...Leave a comment:
-
In addition:
The Label inside the Panel doesn't seem to want to change, either. If I leave the Panel visible and tell the text to change to an arbitrary string on button click, it doesn't. Something's fishy, but I don't know what.Leave a comment:
-
C#: Panel Won't (Un)Hide
I have a panel that I want to act as an extension of ValidationSumma ry. Some fields are simply too complex for a RegEx to analyse, so I check them on a button click event and pass error messages to a Label contained in the aforementioned Panel.
Trouble is, the Panel doesn't unhide! A rougher alternative I tried, if (!IsPostBack), doesn't work either.
[code=html]
<form id="Form1" method="POST"... -
ddlB is filled through FillBList(), which is more or less FillAList() adjusted for different data:
[code=cpp]public DataSet FillBList()
{
SqlConnection fillConnection = new SqlConnection(c onnection_strin g);
DataSet listDataSet = new DataSet();
SqlDataAdapter listAdapter = new SqlDataAdapter( "SELECT ID, Name FROM TableB UNION SELECT -1, '' ORDER BY Name", fillConnection) ;
...Leave a comment:
-
DataGrid_Update Sees One DropDownList, Ignores Another
Assume a DataGrid that, during edit mode, has two DropDownMenus, ddlA
and ddlB. Upon clicking 'Save,' the app performs the simplified task
of copying the DDL values of each to a label.
[code=cpp]public void dg_Update(Objec t sender, DataGridCommand EventArgs e)
{
// VARIABLES --------------
DropDownList ddlA = (DropDownList) e.Item.FindCont rol("ddlAEdit") ;
DropDownList... -
Hmmm, I haven't found the proper way to bind whilst keeping the DDL index intact. Occasional tests return values other than -1, but they're always the old, default values and not the newly selected values.
This configuration of binds achieves the latter. It's probably missing several binds to achieve 100% functionality (e.g., cancelling is missing one), but I'm just focusing on getting the DDL to respond:
[code=cpp]private...Leave a comment:
-
OK, but if I remove data binding from the (!IsPostBack) block, every time I execute an action inside DataGrid (edit, delete, etc.), the data won't be updated. Clicking 'Edit' will produce duplicate rows, and deleted rows will still show up....Leave a comment:
-
C#: SelectedIndex Returns -1
This function fires when the DataGrid roleList is updated by clicking 'Save' on a given row. Successful operation involves finding a DropDownList, getting its SelectedIndex, and printing it on a label:
[code=cpp]
public void roleList_Update (Object sender, DataGridCommand EventArgs e)
{
// VARIABLES --------------
DropDownList ddlCompany = (DropDownList) e.Item.FindCont rol("ddlCompany Edit");... -
C#: 'There is no row at position 0'
I have a DataGrid and am attempting to have in-grid data editing. At the moment I'm working with a single DropDownList:
[code=cpp]public void roleList_Update (Object sender, DataGridCommand EventArgs e)
{
int newRoleID = 666;
DropDownList ddl = (DropDownList) e.Item.FindCont rol("ddlRoleEdi t");
if (ddl != null)
newRoleID = int.Parse(ddl.S electedValue);
... -
Still having no luck. In addition, I used the wrong EventArgs type, even though I swear it worked at one point. The corrected C# code is below. With plain old EventArgs, it's even harder than before to do what I want.
[code=cpp]public void ddlRoleEdit_Ite mDataBound(Obje ct sender, EventArgs e)
{
DropDownList ddl = (DropDownList) sender;
ddl.SelectedVal ue = ***
}[/code]Leave a comment:
-
(C#) DropDownList Using SelectedIndex w/ onDataBinding
I have a DataGrid and a column that changes into a DropDownList when edited:
[code=html]
<columns>
<asp:templateco lumn headertext="Rol e Type">
<itemtemplate >
<asp:hyperlin k id="hlinkRoleTy pe" navigateurl='<% # "contact_roles_ details.aspx?id =" + DataBinder.Eval (Container, "DataItem.I D", "{0}").ToString () %>' Text='<%# DataBinder.Eval (Container,...
No activity results to display
Show More
Leave a comment: