|
is it possible to add a temporary data in bound dropdownlist?
i have dropdownlist with data from database
tblCode
Code CodeName<br />
1 AAAA<br />
2 BBBB<br />
3 CCCC<br />
4 DDDD
then sometimes user just put 0 in dropdownlist
just like in combobox in access, behaving like textbox.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
your question is not clear for me, can you please give me more info
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
ok. apologize.
here's the new question::
How can I make asp dropdownlist treat like combobox just the same in access?
In access, combobox is behaving like textbox meaning
you can input directly whatever you want.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
|
thanks. but i currently used this.
what i need is i want to input any data on the
dropdownlist which is not found in the database.
in your link given.
yes, i can type the letter,its good but what if
i will type numbers on dropdown or words that cannot be found on the dropdown.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You should use AutoComplete extender control for this purpose.
Use this extender for a TextBox instead of a DropDownList. Populate the autocomplete data from the database.
Please have a look at the demo here[^].
|
|
|
|
|
Hi,
I have a checkbox inside a gridview which is bound to data at runtime except the checkbox templatefield.
At server side I am trying to capture the row details for the row which is selected. I get the checkbox but the checkbox.checked is always false even when it is selected.
protected void btnSelect_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkAgency");
if (chk != null && chk.Checked)
{
Response.Cookies["thistestcookie"].Value = row.Cells[0].Text.ToString();
}
}
how do i get the checked checkbox row details ?!
Thanks,
Fifi
|
|
|
|
|
lets see the markup where you defined the checkbox ?
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
<Columns>
<asp:BoundField DataField = "Name1" HeaderText = "NAME" />
<asp:BoundField DataField ="Name2" HeaderText = "NAME2"/>
<asp:BoundField DataField = "Name3" HeaderText = "NAME3"/>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox id ="chkAgency" runat="server" Enabled />
</ItemTemplate>
</asp:TemplateField>
</Columns>
|
|
|
|
|
ok i see where your problem is. You assume if you add a checkbox, it will carry the ID of the checked field , that is not true. I normally create an extra template field and bind the label with the value and as you did on the server side, i find the label and get the value. I have compiled an example and this will help you
html
<asp:GridView ID="GridView1" AutoGenerateColumns="False" runat="server"
DataSourceID="SqlDataSource1">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkAgency" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%# Eval("ID")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField = "ID" HeaderText = "ID" InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField ="Descr" HeaderText = "Descr" SortExpression="Descr"/>
<asp:BoundField DataField = "LongName" HeaderText = "LongName"
SortExpression="LongName"/>
<asp:BoundField DataField="Capacity" HeaderText="Capacity"
SortExpression="Capacity" />
<asp:BoundField DataField="Note" HeaderText="Note" SortExpression="Note" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:TTBLv3MasterConnectionString %>"
SelectCommand="select * from dbo.TBL_VENUE"></asp:SqlDataSource>
<asp:Button ID="btntest" Text="Test" runat="server" onclick="btntest_Click" />
and the server side
protected void btntest_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
CheckBox chk = (CheckBox)row.FindControl("chkAgency");
Label lblid = (Label)row.FindControl("lblid");
List<string> lstList = new List<string>();
if (chk != null && chk.Checked)
{
lstList.Add(lblid.Text);
}
}
}
Thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I create a gridview with runtime columns. after that add textbox in this column.
Here the code.
protected void grdOne_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
TemplateField T = new TemplateField();
grdOne.Columns.Add(T);
GridViewRow gvr = e.Row;
TableCell tcell = new TableCell();
for (Int32 i = 0; i < columnCounter; i++)
{
TextBox tb = new TextBox();
tb.Width = 30; tb.Text = "0";
tb.ID = "tb_" + i.ToString();
tcell.Controls.Add(tb);
}
gvr.Cells.Add(tcell);
grdOne.Controls[0].Controls.AddAt(0, gvr);
}
}
But when i fetch textbox value from this grid that comes with error.
can any one tell me how to fetch textbox value from my grid
m using these line of code to fetch textbox values
public void GetArray(GridView grd)
{
String[,] ar = new String[rowCounter, columnCounter];
for (int i = 0; i < grd.Rows.Count; i++)
{
for( int j=1; j<= grd.Columns.Count; j++)
{
String tId = "grdOne_ctl03_tb_" + j.ToString();
String t = ((DataControlFieldCell)(grd.Rows[i].FindControl()).text;
}
}
}
|
|
|
|
|
Something issue with control Id, it's not able to find the exact control id. It may be issue with control hierarchy. I have some suggestion for you:
1. If you want to follow the same code then view the page source and see what is name of control id and under which parent control has created.
2. Other way, Create a template column at design time and put there a panel. On runtime find the panel and add the all textbox control inside the panel.
same way, during retrieval find the Panel and traverse the all child control.
Thanks,
Parwej Ahamad
ahamad.parwej@gmail.com
|
|
|
|
|
I want to get Session Value in asp.net which location is app_code folder.
below is good work in asp.net code but not work in c# code.
How can i do?
Have a nice day~
example)
string idValue = Session["ID"].Tostring();
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
Hi!
I don't know how you keep session in app_code folder. Anyways Create the static class for session under the app_code folder and use it where you want.
Class should be like that..
public static class SessionManager
{
private static string _Id= "DefaultID";
public static string ID
{
get
{
if (HttpContext.Current.Session[SessionManager._Id] == null)
{
return string.Empty;
}
else
{
return HttpContext.Current.Session[SessionManager._Id].ToString();
}
}
set
{
HttpContext.Current.Session[SessionManager._Id] = value;
}
}
}
///////////////////////////////
and use like that
SessionManager.ID="testId1213"; //set
string idValue =SessionManager.ID; //get
|
|
|
|
|
in a Class Library or in a Class you cant just access the Session Variable like that, so you will need to do it like this
HttpContext.Current.Session["MySession"].ToString();
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
use correct namespace and object
HttpContext.Current for getting same.
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Whenever I try to download Visual Web dev 2010, when I go to open it the user interface shows all its text as box characters!
|
|
|
|
|
Did you contact any support of that site ?
suchita
|
|
|
|
|
Dear;
I use ASP.NET web site
Type: Visual Basic
.Net Frame work 4
When we give the path of other page ,without Login page Like http://localhost:1413/Main.aspx,It must go to Login page
(web application RUN time)
Thanks
|
|
|
|
|
The feature that you are looking for is provided by Forms Authentication[^]. There are lots of information on web[^] regarding the same.
OR
You can do this yourself. Keep a session flag in your application. Set it to true/logged-in, once someone logins. Orelse keep it as false/not-logged-in. On any other page load, check the value of this session and move accordingly. If you find its value as false then do a hard Response.Redirect yourself in the code to login page.
|
|
|
|
|
Look at this
http://www.dotnetfunda.com/articles/article808-how-to-write-a-simple-login-page-in-aspnet-.aspx[^]
Now to extend this , you will need a Session variable that will carry the username of the Successful login and every page you must check if the Session is null , if its null redirect the user to the Login Page like this
if(Session["Usernane"] == null)
{
response.redirect("Login.aspx",false);
}
and when you are done with the session, meaning when the user logs out then you must abandon the session. or set it to null
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I want to encapsulate the Data Access Layer in a class library project where the class library will contain LINQ to SQL classes and Business Logic Layer. For my ASP.NET Web application, I will add that class library reference so that the ASP.NET Web application just behave like the Presentation Layer. I am highly tempted to implement this architecture. But I just got one challenge. As the Data Access Layer will maintain the Connection String of the SQL database in Web.Config file, when I reference that class library DLL to my ASP.NET Web Application, how will the Web.Config file of that class library project get integrated to my web.config file of the presentation ASP.NET Web Application ?
At this moment, I am using ASP.NET 4.0 which has a cool feature : Web.Config.Debug, Web.Config.Release, so I can place the connection string of my production server website at Web.Config.Release. But, now, looks like, I will have to miss that feature as I am not sure how Web.Config (or App.Config) file will behave in my Data Access Layer class library project.
Would you please give me some idea ?
|
|
|
|
|
|
Hello,
Thanks for your reply. I understood how to read connection string from my DAL. But, the DAL class library will be compiled to a single DLL file which can be added as a reference to my Presentation Web Application, how can I import that config file to my Presentation Web Application where the Presentation Web Application already contains Web.Config file. Wont that conflict ? Moreover, when the DAL assembly is added to the Presentation layer Web App, will my DAL DLL know that what is the config file it must read from ?
|
|
|
|
|
Any assemblies used in your application will use the configuration file from the main executable, unless otherwise specified. Copy the settings necessary for your data access layer to the web.config file.
I know the language. I've read a book. - _Madmatt
|
|
|
|