Click here to Skip to main content
16,005,126 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionReturn XML in stead of HTML Pin
Eduard Keilholz4-Jan-07 1:59
Eduard Keilholz4-Jan-07 1:59 
AnswerRe: Return XML in stead of HTML Pin
DavidNohejl4-Jan-07 2:01
DavidNohejl4-Jan-07 2:01 
GeneralRe: Return XML in stead of HTML Pin
Eduard Keilholz4-Jan-07 2:06
Eduard Keilholz4-Jan-07 2:06 
GeneralRe: Return XML in stead of HTML Pin
J4amieC4-Jan-07 2:53
J4amieC4-Jan-07 2:53 
GeneralRe: Return XML in stead of HTML Pin
Jamie Nordmeyer4-Jan-07 12:09
Jamie Nordmeyer4-Jan-07 12:09 
QuestionVS 2005 Pin
manojkumarphate4-Jan-07 1:31
manojkumarphate4-Jan-07 1:31 
AnswerRe: VS 2005 Pin
ednrgc4-Jan-07 3:59
ednrgc4-Jan-07 3:59 
QuestionHelp in GridView...PLz..... Pin
varshavmane4-Jan-07 1:25
varshavmane4-Jan-07 1:25 
Hi all,
I have GridView which contains few columns of checkbox.My problem is how do I insert or Update Database on save button click(this button is outside the GridView).Following is the code what I have use but not getting where do U update DB:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" Width="100%" CellPadding="4"
ForeColor="#333333" GridLines="None">
<Columns>
<asp:BoundField DataField="FormID" HeaderText="FormID"
InsertVisible="False" ReadOnly="True" SortExpression="FormID">
<HeaderStyle Width="50px" />
</asp:BoundField>
<asp:BoundField DataField="FormName" HeaderText="Form Name"
SortExpression="Name" >
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Add" SortExpression="Add">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkAdd" runat="server" Checked='<%# IsActive(Eval("Add")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Modify" SortExpression="Modify">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkModify" runat="server" Checked='<%# IsActive(Eval("Modify")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Delete" SortExpression="Delete">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkDelete" runat="server" Checked='<%# IsActive(Eval("Delete")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="View" SortExpression="View">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkView" runat="server" Checked='<%# IsActive(Eval("View")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Print" SortExpression="Print">
<ItemTemplate>
<center>
<asp:CheckBox ID="chkPrint" runat="server" Checked='<%# IsActive(Eval("Print")) %>' />
</center>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333"
HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

Public Shared Function IsActive(ByVal sValue As String) As Boolean
If sValue = "True" Then
Return True
Else
Return False
End If
End Function

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
Dim index As Integer
Dim sCB1Add As String = String.Empty
Dim sCB2Modify As String = String.Empty
Dim sCB3Delete As String = String.Empty
Dim sCB4View As String = String.Empty
Dim sCB5Print As String = String.Empty

For index = 0 To GridView1.Rows.Count - 1
Dim gvRow As GridViewRow = GridView1.Rows(index)
If CType(gvRow.FindControl("chkAdd"), CheckBox).Checked Then
sCB1Add = "1"
Else
sCB1Add = "0"
End If
If CType(gvRow.FindControl("chkModify"), CheckBox).Checked Then
sCB2Modify = "1"
Else
sCB2Modify = "0"
End If
If CType(gvRow.FindControl("chkDelete"), CheckBox).Checked Then
sCB3Delete = "1"
Else
sCB3Delete = "0"
End If
If CType(gvRow.FindControl("chkView"), CheckBox).Checked Then
sCB4View = "1"
Else
sCB4View = "0"
End If
If CType(gvRow.FindControl("chkPrint"), CheckBox).Checked Then
sCB5Print = "1"
Else
sCB5Print = "0"
End If
Next

End Sub

Please help me as I am new for 2005 Version.

Thanks....

AnswerRe: Help in GridView...PLz..... Pin
Venkatesh Mookkan4-Jan-07 15:39
Venkatesh Mookkan4-Jan-07 15:39 
QuestionHow to Clear GridView Pin
aaraaayen4-Jan-07 1:18
aaraaayen4-Jan-07 1:18 
AnswerRe: How to Clear GridView [modified] Pin
Sebastien Lachance4-Jan-07 3:42
Sebastien Lachance4-Jan-07 3:42 
GeneralRe: How to Clear GridView Pin
aaraaayen4-Jan-07 17:49
aaraaayen4-Jan-07 17:49 
AnswerRe: How to Clear GridView Pin
Venkatesh Mookkan4-Jan-07 15:42
Venkatesh Mookkan4-Jan-07 15:42 
QuestionReading Excel document in ASP.NET Pin
Kais4U4-Jan-07 1:12
Kais4U4-Jan-07 1:12 
AnswerRe: Reading Excel document in ASP.NET Pin
minhpc_bk4-Jan-07 18:54
minhpc_bk4-Jan-07 18:54 
QuestionServer Application unavailable Pin
Imran Khan Pathan4-Jan-07 0:16
Imran Khan Pathan4-Jan-07 0:16 
AnswerRe: Server Application unavailable Pin
ednrgc4-Jan-07 4:00
ednrgc4-Jan-07 4:00 
AnswerRe: Server Application unavailable Pin
Venkatesh Mookkan4-Jan-07 15:48
Venkatesh Mookkan4-Jan-07 15:48 
QuestionPlz help me Pin
Imran Khan Pathan3-Jan-07 23:42
Imran Khan Pathan3-Jan-07 23:42 
AnswerRe: Plz help me Pin
ednrgc4-Jan-07 4:01
ednrgc4-Jan-07 4:01 
Questionuploading asp.net files? Pin
sacheesach3-Jan-07 23:39
sacheesach3-Jan-07 23:39 
AnswerRe: uploading asp.net files? Pin
enjoycrack3-Jan-07 23:52
enjoycrack3-Jan-07 23:52 
GeneralRe: uploading asp.net files? Pin
sacheesach4-Jan-07 0:33
sacheesach4-Jan-07 0:33 
GeneralRe: uploading asp.net files? Pin
Paddy Boyd4-Jan-07 1:20
Paddy Boyd4-Jan-07 1:20 
GeneralRe: uploading asp.net files? Pin
sacheesach4-Jan-07 2:10
sacheesach4-Jan-07 2:10 

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.