मैं एक सूची दृश्य का उपयोग कर रहा हूं जिसमें आइटम टेम्पलेट में मैं एक लेबल और चेकबॉक्स का उपयोग कर रहा हूं। मैं चाहता हूं कि जब भी उपयोगकर्ता चेक बॉक्स पर क्लिक करता है तो मूल्य को तालिका में अपडेट किया जाना चाहिए। मैं सूचीदृश्य में डेटाकेस का उपयोग कर रहा हूं। डेटाकेय मान के आधार पर तालिका में अपडेट किया जाना चाहिए। क्वेरी है:ASP.NET में ListView में चेकबॉक्स की चेक किए गए चेंज किए गए ईवेंट पर डेटा कुंजी कैसे खोजें?
string updateQuery = "UPDATE [TABLE] SET [COLUMN] = " + Convert.ToInt32(chk.Checked) + " WHERE PK_ID =" + dataKey + " ";`
भी मैं परिणाम प्रदर्शित के रूप में यह table.means अंदर है अगर एक विशेष pkid के लिए तालिका में कॉलम के लिए मूल्य 1 तो चेकबॉक्स जाँच की जानी shoul है में कुछ मदद चाहते हैं।
<asp:ListView ID="lvFocusArea" runat="server" DataKeyNames="PK_ID" OnItemDataBound="lvFocusArea_ItemDataBound">
<LayoutTemplate>
<table border="0" cellpadding="1" width="400px">
<tr style="background-color: #E5E5FE">
<th align="left">
Focus Area
</th>
<th>
Is Current Focused
</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td width="80%">
<asp:Label ID="lblFocusArea" runat="server" Text=""><%#Eval("FOCUS_AREA_NAME") %></asp:Label>
</td>
<td align="center" width="20%">
<asp:CheckBox ID="chkFocusArea" runat="server" OnCheckedChanged="chkFocusArea_CheckedChanged" AutoPostBack="true" />
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr style="background-color: #EFEFEF">
<td>
<asp:Label ID="lblFocusArea" runat="server" Text=""><%#Eval("FOCUS_AREA_NAME") %></asp:Label>
</td>
<td align="center">
<asp:CheckBox ID="chkFocusArea" runat="server" OnCheckedChanged="chkFocusArea_CheckedChanged" AutoPostBack="true" />
</td>
</tr>
</AlternatingItemTemplate>
<SelectedItemTemplate>
<td>
item selected
</td>
</SelectedItemTemplate>
</asp:ListView>
सहायता मुझे:
यहाँ कोड का टुकड़ा है।
जांच अद्यतन जवाब –
यह अनिवार्य है geting की अपनी समस्या को हल करने में मदद कर सकते हैं? – Subbu
यह अनिवार्य नहीं है कि आपको यह स्वीकार करना पड़ेगा कि यह काम करता है, ठीक है, मैं उस मामले में अपना उत्तर हटा दूंगा –