0
1-first create a database table ,in which write field like id,name salary
2-After it stablish connection.
3-Take a asp control kike repeter ,datagrid etc.
4-And write that code into source code file;
<ItemTemplate>
</ItemTemplate>
<asp:Textbox ID ="ti" runat="server" width="60px"><%Eval("id") %></asp:Textbox>
</asp:Repeater>
0
Just try like below......
<TemplateField HeaderText='name">
<ItemTemplate>
<asp:textbox="txtname" runat="server" width="70px"></textbox>
</ItemTemplate>
</TemplateField>
0
If you are using edit Item template then you can set your textbox's width from aspx.
but when you use bound fields then you can esize textboxes from edit Command by,
((Textbox)(e.rows[e.editIndex].cell[0].control[0])).width = 100px;
try this....
0
Thanks for your repley Senthilkumar,
But there is no textbox control on my code. I mean When I click the "edit", textbox's appears automatically.
-------------------------------------------------------------------
<asp:DataGrid ID="DataGrid1" RUNAT="server" AutoGenerateColumns="False"
OnUpdateCommand="komut_update" OnEditCommand="komut_edit"
OnCancelCommand="komut_cancel" CellPadding="4" ForeColor="#333333" GridLines="None" Width="400px" >
<AlternatingItemStyle BackColor="White" />
<Columns>
<asp:EditCommandColumn EditText="Düzenl" CancelText="Vazgeç" UpdateText="Güncelle" HeaderText="Düzenle" />
<asp:BoundColumn HeaderText="ID" DataField="ID" ReadOnly="false" />
<asp:BoundColumn HeaderText="IP" DataField="IP" />
</Columns>
<EditItemStyle BackColor="#2461BF" Height="50" />
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#EFF3FB" Width="100" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedItemStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
</asp:DataGrid>
-------------------------------------------------------------------
When I change the "editItemStyle" propeties above, I can change somethings but not textbox's.

0
Hi,
You can restrict the width of the text box in either way
<asp:TextBox ID="txtIPAddress" runat="server" Width="85px"></asp:TextBox>
<asp:TextBox ID="txtIPAddress" runat="server" style="width:85px;"></asp:TextBox>
If you want to maintain this size in many problems then you are adivsed to do through css
.TextBox85
{
width:85px;
}
<asp:TextBox ID="txtIPAddress" runat="server" CssClass="TextBox"></asp:TextBox>
If you want to set the size at the time of editing then edit command,
you can find the control and set the width to it.
TextBox txtIPAddress = (TextBox) e.FindControl("txtIPAddress");
txtIPAddress.Width = system.web.ui.webcontrols.unit.pixel(85)
Hope this will help you.