2
Answers

bind data to gridview without database

Ramya S

Ramya S

8y
291
1
My webform consists textbox,checkbox,radiobutton,on submit the data to bind to grindview and display.
here my aspx code is:
<body>
<form id="form1" runat="server">
<div>
<table border="0" align="center">
<tr><td>name:</td><td><asp:TextBox id="txt1" size="20" runat="server" ></asp:TextBox>
</td></tr>
<tr><td>mobile number:</td><td><asp:TextBox id="txt2" onkeypress="return Check_Nums(event)" maxlength="13" runat="server"></asp:TextBox></td></tr>
<tr><td>Email:</td><td><asp:TextBox id="mail" onblur="return emailvald()" runat="server"></asp:TextBox></td></tr>
<tr>
<td>
state:
</td><td>
<select name="state" id="state">
<option value="select" selected="selected" runat="server">select</option>
<option value="ap">AP</option>
<option value="tp">TP</option>
<option value="up">up</option>
<option value="mp">mp</option>
</select>
</td>
</tr>
<tr>
<td> select course:</td>
<td><input type="checkbox" id="chb1" onclick="return disc()" runat="server"/>html(300 rs)<br /></td>
</tr>
<tr><td> </td><td><input type="checkbox" id="chb2" onclick="return disc()" runat="server"/>javascript-css(1000 rs) </td></tr>
<tr><td> </td> <td><input type="checkbox" id="chb3" onclick="return disc()" runat="server"/>c(500 rs)</td></tr>
<tr><td> </td> <td><input type="checkbox" id="chb4" onclick="return disc()" runat="server"/>.net(2500 rs)</td></tr>
<tr><td> </td><td><input type="checkbox" id="chb5" onclick="return disc()" runat="server"/>java(3000 rs)</td></tr>
<tr><td>Applictiona fee:</td><td><input type="text" id="appid" readonly="readonly" value="50" runat="server"/>(* application fee (50 rs/-)</td></tr>
<tr><td>Total amount:</td><td><input type="text" id="totid" readonly="readonly" runat="server"/>(include application fee.)</td></tr>
<tr><td>Timmings:</td><td><input type="radio" id="rd1" name="time" runat="server"/>7:00-9:00am(fasttrack)</td></tr>
<tr>
<td> </td>
<td>
<input type="radio" id="rd2" name="time" runat="server"/>11:00-12:00pm(normaltrack)
</td>
</tr>
<tr>
<td> </td>
<td>
<input type="radio" id="rd3" name="time" runat="server"/>5:00-7:00pm
</td>
</tr>
<tr><td></td><td>
<asp:Button ID="sub" runat="server" Text="submitt" OnClientClick="return func()" OnClick="sub_Click" />
</td></tr>
</table>
<table border="0" align="center">
<asp:GridView ID="gvbind" AutoGenerateColumns="false" runat="server">
<Columns>
<asp:BoundField HeaderText="Name" DataField="name"/>
<asp:BoundField HeaderText="Email" DataField="email" />
<asp:BoundField HeaderText="Selectcourse" DataField="selectcourse" />
<asp:BoundField HeaderText="Total Amount" DataField="totalamount" />
</Columns>
</asp:GridView>
</table>
</div>
</form>
</body>
 and my cs code:
public partial class jsv : System.Web.UI.Page
{
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("name"));
dt.Columns.Add(new DataColumn("email"));
dt.Columns.Add(new DataColumn("selectcourse"));
dt.Columns.Add(new DataColumn("totalamount"));
DataRow dr = dt.NewRow();
gvbind.DataSource = dt;
gvbind.DataBind();
}
}
protected void sub_Click(object sender, EventArgs e)
{
DataRow dr = dt.NewRow();
dr[1] = txt1.Text;----------------imgetting error here
dr[2] = txt2.Text;
gvbind.DataSource = dt;
gvbind.DataBind();
}
And i need how to bind multiple checked  value and radio button value in gridview  
 
Answers (2)
0
kevint
NA 54 0 20y
Try this. " Salamander .NET Linker and mini-deployment tool allows you to link .NET assemblies together into a single file, and to deploy your application without installation of the whole Microsoft .NET Framework. The linker selectively links MSIL code putting together only the required classes and methods, and it is capable of linking into the Microsoft .NET framework class libraries. The mini-deployment tool then builds a minimum set of the Microsoft .NET runtime to ship with your application. This usually results in installation size of a few mega bytes, rather than tens of mega bytes, and the installation takes much less time without rebooting machines. The mini-deployed application can be launched directly from a CD, absolutely without copying files or adding registry entries." Regards KevinT
0
erwache
NA 4 0 20y
thanks for your replies.. i just thought, that it would be possible, to bind the methods and modules which i need into the .exe so that the exe grows, but obviously it is not possible - what a pity thx maschka
0
spgilmore
NA 591 0 20y
Dynamic and static binding are terms of how the libraries of the runtime are loaded at runtime. Neither of these have to do with linking runtime libraries inside the executable.
0
vitenyi_i
NA 38 0 20y
In the same way that you couldn't run a program coded to the Win API on a non-Windows machine, a program coded to the .NET framework needs the .NET framework.