|
Hai all,
i am new to .net.
i just want to know ,
if there are two dropdown lists,i populate one dropdown from database table products,then some data about the customer(anothertable) will be populated in second dropdownlist.
and after that ,if i select the customer then data related to first and second dropdown list will be visible in the gridview?
can any body send me the code related to it?
Thanks
Subbu.
|
|
|
|
|
if you are Binding GridView with SqlDataSource then use FilterExpression of SqlDataSource then bind again GridView
example:
SqlDataSource1.FilterExpression = "ColName ='"+getSelectedItemofDropDownList+"'";<br />
GridView1.DataBind();
I Love SQL
|
|
|
|
|
hai,
Thanks for u r reply,
my requirement is second dropdown will be filled relaeted to first one and after that display the gridview.
can u send me the full code?
Thanks
Subbu.
|
|
|
|
|
here is a sample code similar to your situation-- loading cities in dropdown inside gridview based on the state selected from the dropdown outside the gridview. this link will provide you atleast something useful. Have a look...
dropdownlist-inside-gridview[^]
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
hai john,
thank u for reply,but my two dropdownlists are outside the gridview,not in itemtemplate.can u send the code for it?
Thanks
Subbu.
|
|
|
|
|
set the AutopostBack Proeprty of Product Dropdown - True
--This Code is to Populate the First DropDown
--call "subInitializeDropDown" on PageLoad
Private Sub subInitializeDropDown()<br />
Dim LocalDataSet as New DataSet<br />
LocalDataSet = SelectAllProducts()<br />
ddlProduct.DataValueField = "Product_ID"<br />
ddlProduct.DataTextField = "product_Name"<br />
ddlProduct.DataSource = LocalDataSet<br />
ddlProduct.DataBind()<br />
End Sub
--This Code you write in the SelectedIndexChanged Event of Product DropDown
Dim LocalDataSet as New DataSet<br />
LocalDataSet = SelectAllCustomer(ddlProduct.selectedValue)<br />
ddlCustomer.DataValueField = "Customer_ID"<br />
ddlCustomer.DataTextField = "Customer_Name"<br />
ddlCustomer.DataSource = LocalDataSet<br />
ddlCustomer.DataBind()
Regards J O H N
"Even eagles need a push." David McNally
|
|
|
|
|
Hai john,
Thanks for u r reply.
it is working
Thanks
Subbu.
|
|
|
|
|
Hi All,
i am working on a web application which saves html file(file consist only formatted text with color, headings, font etc.). i need to write this formatted text to a word file(on click of a button). i am doing it like this:-
// on click of button, i call this function.
private void write()
{
object oMissing = System.Reflection.Missing.Value;
//Start Word and create a new document
Word._Application oWord; // word application object
Word._Document oDoc; // word document object
oWord = new Word.Application();
oWord.Visible = true;
// open new word file
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing,
ref oMissing, ref oMissing);
//Insert a paragraph at the beginning of the document.
Word.Paragraph oPara1;
oPara1 = oDoc.Content.Paragraphs.Add(ref oMissing);
// call a method setContent(), which will return string
(here string will contain html file content(text) like:-
<code><div class="ForumSig"><b>here all my formatted text will go, it can be any number of paragraphs with any type of formatting, but will have text only</b><u><b>CodeProject<b></u></div></code>
)
string tcontent = setContent();
oPara1.Range.Text = tcontent;
// write returned html content(string) to opened word file.
oPara1.Range.InsertParagraphAfter();
}
this is simply what i am doing, this opens a new word file and writes all what my function "setContent()" returns (a string representing html file content).
now problem is that it is writing that string as it is means if string is <code>
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh, then it is writing it same way without converting it as html equivalent like it should be displayed as:-
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily Akhilesh Singh
can any of members have any good idea about how can i write it so it will come as html means all tags will be changed as html equivalent data or (content).. plz plz help me out if any one knows how to?
Thanks Akhilesh
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
|
|
|
|
|
akhilesh@slk wrote: i am working on a web application which saves html file(file consist only formatted text with color, headings, font etc.). i need to write this formatted text to a word file
An easy solution would be changing the HTML extension to .doc and save. This works for me.
|
|
|
|
|
Yes Navaneeth this will work for some situation, in my case i am using a third party tool for text editing. user can enter any text on that tool(supports formatting through it's own options on tool) and click on on save button, then i need to save the content in database, those content will be like having color , fond, and some other properties for faormatting the text(including text too).
this tool has one prorerty named as "content", i can only access user entered text with this property "content", which always holds string of all above proerties(like font etc with user entered text) which i just reffered.
when i will take this string and save to database it will saved as it is(proerties + text). when i open a word document and assign this string(which i will retirieve from database in a string) to a paragraph and will write to word, it will take whole string and write it as it is like if html content was <b>"People"</b> it will write <b>People often</b> into the word, not like just making "People" as bold(i mean it will ignore all html tags and consider those as normal set of characters only and will write tags too).
so i think it is something different from the condition for which this suggestion might have work for you.
if i am wrong please let me know...
People often say that motivation doesn't last. Well, neither does bathing - that's why we recommend it daily
Akhilesh Singh
-- modified at 8:17 Tuesday 11th September, 2007
|
|
|
|
|
How can we authenticate users in http handlers. I mean only allow users who are authenticated to use the http handlers ???
ppl that are in a certain page.
Is there anyway to see on server side wether a user calling the XmlRequest.open(...);XmlRequest.send(); method is on the page we want .??
|
|
|
|
|
How do u use IIS to publish a site in my network i'm totaly stuck
can anyone help me
|
|
|
|
|
i want to help you but for that regards plz explain your problem properly, because to publish a site there is no use for IIS. Tell me what excatly you want to do.
regards
Yogesh
|
|
|
|
|
|
Hi
I have 3 listboxes on my webpage,The first one which is ListBox2,when that page loads it display all the project members,It does that.
That second and third ones when the user clicks the button it should display all the selected members in second listbox (ListBox1) and their Email address in the third listBox (ListBox3).
This is my Code for the button click ,when the page loads it display all the project members but,when I chick the button ,it only display the selected members in the second Listbox(ListBox1)and doesn't display their email address in the third ListBix(ListBox3)
**I WANT IT TO DISPLAY ALSO THE EMAIL ADDRESS IN THE THIRD LISTBOX,PLEASE HELP ME
Protected Sub bntAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles bntAdd.Click
If ListBox2.SelectedIndex >= 0 Then
Dim i As Integer
For i = 0 To ListBox2.Items.Count - 1
If ListBox2.Items(i).Selected Then
If Not lasset.Contains(ListBox2.Items(i)) Then
lasset.Add(ListBox2.Items(i))
End If
End If
Next i
For i = 0 To lasset.Count - 1
If Not ListBox1.Items.Contains(CType(lasset(i), ListItem)) Then
ListBox1.Items.Add(CType(lasset(i), ListItem))
End If
ListBox2.Items.Remove(CType(lasset(i), ListItem))
Next i
Else 'ListBox2.SelectedIndex >= 0 Then
Dim UserAdmin_Id As Integer
Dim ds As New Data.DataSet
Dim objdata As Businesslayer.TimeSheet = New Businesslayer.TimeSheet
ds = objdata.GetMemberEmail(UserAdmin_Id)
Dim Email As Integer
For Email = 0 To ListBox2.Items.Count - 1
If ListBox2.Items(Email).Selected Then
If Not lasset.Contains(ListBox2.Items(Email)) Then
lasset.Add(ListBox2.Items(Email))
End If
End If
Next Email
For Email = 0 To lasset.Count - 1
If Not ListBox3.Items.Contains(CType(lasset(Email), ListItem)) Then
ListBox3.Items.Add(CType(lasset(Email), ListItem))
End If
ListBox1.Items.Remove(CType(lasset(Email), ListItem))
Next Email
End If
End Sub
|
|
|
|
|
when i press back button in IE the previous web page dosn't reload, it shows the old data
how can i make the page reload when i press the back button on IE??
-- modified at 4:50 Tuesday 11th September, 2007
|
|
|
|
|
What you want to do ? means how your appliction should behave wheh user click back button of IF
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
thanx i solved the problem
thank you for help
|
|
|
|
|
Hi
How should we use ajax and prevent abuse . Http handlers can be called by anyone. What is the way to use ajax and just limit usage to only that page. in the code below:
xmlHttpObj.open('GET','http://' + location.host +<br />
myserver.ashx', true);
anyone who see the source code can recover the serving page
|
|
|
|
|
I add certain controls to table than i add the table to panel every time user preses add conrtrol than i write some text in the controls added and press submit but when i try to acess the table from the panel. the panel has no table
|
|
|
|
|
u must override OnInit Event and place codes in this section
or send me, your codes for check it and reply to u.
We Can Do Anything, If We Want It
|
|
|
|
|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
//System.Collections.ArrayList ar = new System.Collections.ArrayList();
Table table = new Table();
Table outtable = new Table();
//Table table;
// Table outtable;
protected void Page_Load(object sender, EventArgs e)
{
//if ((Session["isaddclicked"] != null) && ((bool)Session["isaddclicked"]))
//{
// if (Session["controlsArray"] != null)
//{
// // ar = (System.Collections.ArrayList)Session["controlsArray"];
// table = (Table)Session["controlsArray"];
// }
//pnContralPanel.Controls.Add(table);
//pnoutputpanel.Controls.AddAt(0,outtable);
// }
//for (int i = 0; i < ar.Count; i=i+2)
//{
// //co (Control)ar[i];
// pnContralPanel.Controls.Add((Control)ar[i]);
// pnContralPanel.Controls.Add((Control)ar[i + 1]);
//}
//pnContralPanel.Controls.Add(table);
}
protected void btnAdd_Click(object sender, EventArgs e)
{
Control tdddddd=pnContralPanel.Controls[0];
if (Session["controlsArray"] != null)
{
table = (Table)Session["controlsArray"];
//pnContralPanel = (Panel)Session["controlsArray"];
}
//Session["isaddclicked"] = true;
String controltoadd = ddControlList.SelectedItem.Text;
Control obj = null;
Label lbl= new Label();
lbl.Text = txtCaption.Text;
if (controltoadd == "Text Box")
{
TextBox tb= new TextBox();
//tb.ID="txt"+txtCaption.Text;
tb.Text=txtValues.Text;
obj = tb;
}
else if (controltoadd == "Drop Down")
{
DropDownList dd = new DropDownList();
//dd.ID = "dd" + txtCaption.Text;
char[] ch={','};
String[] sepstring = txtValues.Text.Split(ch);
for (int i = 0; i < sepstring.Length; i++)
{
dd.Items.Add(sepstring[i]);
}
obj=dd;
}
else if (controltoadd == "Check Box")
{
CheckBox cb = new CheckBox();
//cb.ID = "cb" + txtCaption;
cb.Text = txtValues.Text;
obj = cb;
}
else
{
return;
}
TableRow tr=new TableRow();
tr.Cells.Add(new TableCell());
tr.Cells.Add(new TableCell());
tr.Cells[0].Controls.Add(lbl);
tr.Cells[1].Controls.Add(obj);
table.Rows.Add(tr);
Session["controlsArray"] = table;
table.ID = "abc";
pnContralPanel.Controls.Add(table);
//Session["controlsArray"] = pnContralPanel;
//pnContralPanel.Controls.AddAt(0, table);
ViewState["state"] = pnContralPanel;
}
protected void Button1_Click(object sender, EventArgs e)
{
// int idcdd=this.Controls.Count;
Session["isaddclicked"] = true;
// pnContralPanel = (Panel)ViewState["state"];
int c=pnContralPanel.Controls.Count;
//string s = pnContralPanel.Controls[0].GetType().ToString();
//cd = (Control)pnContralPanel.Controls[0];
Table t = (Table)pnContralPanel.Controls[0];
//Control tbcontrol = pnContralPanel.Controls[0];
//Table t = (Table)tbcontrol;
// table = (Table)pnContralPanel.Controls[0];
for (int i = 0; i < table.Rows.Count; i++)
{
TableRow toutr = new TableRow();
toutr.Cells.Add(new TableCell());
toutr.Cells.Add(new TableCell());
TableRow tr = t.Rows[i];
for (int j = 0; j < tr.Cells.Count; j++)
{
Control cn = tr.Cells[j].Controls[0];
Type tobj = cn.GetType();
switch (tobj.ToString())
{
case "System.Web.UI.WebControls.Label":
Label caption = (Label)cn;
Label ongoinglbl = new Label();
ongoinglbl.Text = caption.Text;
toutr.Cells[j].Controls.Add(ongoinglbl);
break;
case "System.Web.UI.WebControls.TextBox":
TextBox txt = (TextBox)cn;
Label value = new Label();
value.Text = txt.Text;
toutr.Cells[j].Controls.Add(value);
break;
case "System.Web.UI.WebControls.DropDownList":
DropDownList dd = (DropDownList)cn;
Label value1 = new Label();
value1.Text = dd.SelectedValue;
toutr.Cells[j].Controls.Add(value1);
break;
case "System.Web.UI.WebControls.CheckBox":
CheckBox cb = (CheckBox)cn;
Label value2 = new Label();
if (cb.Checked)
{
value2.Text = "yes";
}
else
{
value2.Text = "no";
}
toutr.Cells[j].Controls.Add(value2);
break;
}
}
outtable.Rows.Add(toutr);
}
pnoutputpanel.Controls.AddAt(0,outtable);
// Session["outTable"] = outtable;
}
}
|
|
|
|
|
I want to work my aspx pages from IIS undependantly.
How could i do?
I aim to create a demonstration CD.
it is a training Cd like CDs in MS Mocs.
i have list of subjects at left and slides at right.
|
|
|
|
|
You can't. The best you can do is to save the html files it generates, and then modify them so that all the links on them link directly to other html files you have created. No postback is going to occur, how successful this can be would depend entirely on how static your site is. If it has a forum, for example, forget it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
How to free-memory(Dispose) for an specific object created an an instance of a class.
any suggestions
Thanks&Regards,
Priya.
|
|
|
|