Click here to Skip to main content
15,900,592 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Tool tip for combobox..., Pin
R.Palanivel3-Sep-07 19:37
R.Palanivel3-Sep-07 19:37 
GeneralRe: Tool tip for combobox..., [modified] Pin
Member 38798813-Sep-07 19:50
Member 38798813-Sep-07 19:50 
GeneralRe: Tool tip for combobox..., Pin
R.Palanivel3-Sep-07 21:46
R.Palanivel3-Sep-07 21:46 
QuestionMaster Page Images Gone Pin
duo!@#3-Sep-07 17:22
duo!@#3-Sep-07 17:22 
AnswerRe: Master Page Images Gone Pin
Sandeep Akhare3-Sep-07 20:04
Sandeep Akhare3-Sep-07 20:04 
AnswerRe: Master Page Images Gone Pin
mihirhp3-Sep-07 20:29
mihirhp3-Sep-07 20:29 
QuestionExport PDF file Pin
AnhTin3-Sep-07 16:46
AnhTin3-Sep-07 16:46 
QuestionCan't update after clicking checkbox Pin
wazodnuit3-Sep-07 15:39
wazodnuit3-Sep-07 15:39 
I'm working with "CheckBox command in Repeater" found here:
<a href="http://www.codeproject.com/useritems/CheckBoxCommand.asp">http://www.codeproject.com/useritems/CheckBoxCommand.asp</a>[<a href="http://www.codeproject.com/useritems/CheckBoxCommand.asp" target="_blank" title="New Window">^</a>]

I cannot find a way to update my database after checking the CheckBox. Which line is the culprit? What's missing?
You may download the aspx page with 1 table database, clicking <a href="http://www3.sympatico.ca/robert-duguay/a1.zip">here</a>[<a href="http://www3.sympatico.ca/robert-duguay/a1.zip" target="_blank" title="New Window">^</a>].


<code><%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>

<script runat="server">

protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
{
// HERE I MESSAGE SELECTED CHECKBOX ID AND VALUE
CheckBox chk = (CheckBox)sender;
MessageLabel.Text = "ItemID: " + chk.Text + " Checked: " + chk.Checked.ToString();

// HERE I CHANGE THE DEFAULT VALUE IN UPDATE PARAMETER OF THE CHECKBOX
AccessDataSource1.UpdateParameters[0].DefaultValue = chk.Checked.ToString();
// TESTER PLUTOT HARD CODED
AccessDataSource1.UpdateParameters[0].DefaultValue = "True";

// HERE I RESPONSE.WRITE JUST TO MAKE SURE MY UPDATE VALUE WAS PASSED
Response.Write("Passed Update parameter: " + AccessDataSource1.UpdateParameters[0].DefaultValue);

// HERE IT DOESN'T WORK !!! WHY ???????????
AccessDataSource1.Update();

}

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Checkbox Command Sample</title>
<meta name="Description" content="" />
<style type="text/css">
.HiddenText label {display:none;}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="MessageLabel" runat="server" EnableViewState="false"></asp:Label>&nbsp;<h2>
Repeater Example</h2>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="AccessDataSource1">
<ItemTemplate>
<asp:CheckBox ID="CheckBox1" Checked='<%#Eval("Flag")%>' Text='<%#Eval("ItemID")%>'
CssClass="HiddenText" AutoPostBack="true" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
<%#Eval("ItemDescription")%>
<br />
</ItemTemplate>
</asp:Repeater>
<br />
<br />
<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/ldh.mdb"
SelectCommand="SELECT [ItemID], [Flag], [ItemDescription] FROM [Table1]"
UpdateCommand="UPDATE [Table1] SET [Flag] = ?, [ItemDescription] = ? WHERE [ItemID] = ?">
<UpdateParameters>
<asp:Parameter Name="Flag" Type="Boolean" />
<asp:Parameter Name="ItemDescription" Type="String" />
<asp:Parameter Name="ItemID" Type="Int32" />
</UpdateParameters>
</asp:AccessDataSource>
<br />
<br />
</form>
</body>
</html>
</code>
AnswerRe: Can't update after clicking checkbox Pin
Christian Graus3-Sep-07 15:58
protectorChristian Graus3-Sep-07 15:58 
QuestionAccessing MS Exchange functionality Pin
Fernando A. Gomez F.3-Sep-07 14:56
Fernando A. Gomez F.3-Sep-07 14:56 
AnswerRe: Accessing MS Exchange functionality Pin
jontyler3-Sep-07 16:13
jontyler3-Sep-07 16:13 
GeneralRe: Accessing MS Exchange functionality Pin
Fernando A. Gomez F.3-Sep-07 17:00
Fernando A. Gomez F.3-Sep-07 17:00 
QuestionValidation Control please help!! Pin
papy-boom3-Sep-07 13:18
papy-boom3-Sep-07 13:18 
AnswerRe: Validation Control please help!! Pin
Christian Graus3-Sep-07 14:00
protectorChristian Graus3-Sep-07 14:00 
GeneralRe: Validation Control please help!! Pin
papy-boom3-Sep-07 14:18
papy-boom3-Sep-07 14:18 
GeneralRe: Validation Control please help!! Pin
Christian Graus3-Sep-07 14:48
protectorChristian Graus3-Sep-07 14:48 
Questioncreate store procedure for decrease stock with quantity [modified] Pin
hardyyanto3-Sep-07 8:35
hardyyanto3-Sep-07 8:35 
AnswerRe: create store procedure for decrease stock with quantity Pin
Christian Graus3-Sep-07 9:54
protectorChristian Graus3-Sep-07 9:54 
QuestionKilling a certan Session. Pin
Saksida Bojan3-Sep-07 8:00
Saksida Bojan3-Sep-07 8:00 
AnswerRe: Killing a certan Session. Pin
Pete O'Hanlon3-Sep-07 8:50
mvePete O'Hanlon3-Sep-07 8:50 
GeneralRe: Killing a certan Session. Pin
Saksida Bojan3-Sep-07 9:52
Saksida Bojan3-Sep-07 9:52 
QuestionCode Execution Prevention Pin
Saksida Bojan3-Sep-07 7:55
Saksida Bojan3-Sep-07 7:55 
Questionasp.net page size (height and width of tables are dynamicaly changed) - a very serious problem Pin
codelinks3-Sep-07 6:44
codelinks3-Sep-07 6:44 
AnswerRe: asp.net page size (height and width of tables are dynamicaly changed) - a very serious problem Pin
Guffa3-Sep-07 7:34
Guffa3-Sep-07 7:34 
GeneralRe: asp.net page size (height and width of tables are dynamicaly changed) - a very serious problem Pin
codelinks3-Sep-07 7:40
codelinks3-Sep-07 7:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.